Implement a cache for the monthly view
Add a very simple cache, which is used to store the days that contain an event or an appointment. This makes redrawing and browsing the calendar panel much faster. The cache has a size of 31 integers (which is equivalent to 124 bytes on a 32 bit system and 248 bytes on a 64 bit system) and invalidates itself if the current month has changed. If an item is added/changed/removed, the cache needs to be invalidated manually by calling calendar_monthly_view_cache_set_invalid(). Note that this will always invalidate the whole cache, even if only one item at the last day of the month was removed. This is a trade-off between simplicity and efficiency. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
@@ -369,6 +369,7 @@ int main(int argc, char **argv)
|
||||
case KEY_GENERIC_IMPORT:
|
||||
wins_erase_status_bar();
|
||||
io_import_data(IO_IMPORT_ICAL, NULL);
|
||||
calendar_monthly_view_cache_set_invalid();
|
||||
inday = do_storage(0);
|
||||
wins_update(FLAG_ALL);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user