diff --git a/NEWS b/NEWS index b75e0ce..ea9b9d7 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,8 @@ 1.4.26: + * Ported all database code to support SQLite in addition to existing the + PostgreSQL support. This is a necessary first step for Luminotes Desktop. + * Updated all unit tests to test against an in-memory SQLite database. This + increases unit test code coverage to include Luminotes SQL code. * Fixed a rare bug in which undeleting a note via "undo" sometimes does not show the undeleted note even if the undelete is successful. diff --git a/controller/Database.py b/controller/Database.py index 28831db..8262d3a 100644 --- a/controller/Database.py +++ b/controller/Database.py @@ -328,6 +328,12 @@ class Database( object ): cache_key = sha.new( sql_command ).hexdigest() cache.delete( cache_key ) + def uncache( self, obj ): + cache = self.__get_cache_connection() + if not cache: return + + cache.delete( obj.cache_key ) + @staticmethod def generate_id(): int_id = random.getrandbits( Database.ID_BITS ) diff --git a/controller/Files.py b/controller/Files.py index 19f104b..835686e 100644 --- a/controller/Files.py +++ b/controller/Files.py @@ -732,6 +732,7 @@ class Files( object ): self.__database.execute( db_file.sql_delete(), commit = False ) user = self.__users.update_storage( user_id, commit = False ) + self.__database.uncache( db_file ) self.__database.commit() user.group_storage_bytes = self.__users.calculate_group_storage( user ) @@ -919,6 +920,7 @@ class Files( object ): # filesystem for ( file_id, db_file ) in files_to_delete.items(): self.__database.execute( db_file.sql_delete(), commit = False ) + self.__database.uncache( db_file ) Upload_file.delete_file( file_id ) self.__database.commit()