When deleting file metadata from the database, also removing that data from the cache.
This commit is contained in:
parent
5afd5a4b73
commit
73219b74ce
4
NEWS
4
NEWS
|
@ -1,4 +1,8 @@
|
||||||
1.4.26:
|
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
|
* Fixed a rare bug in which undeleting a note via "undo" sometimes does not
|
||||||
show the undeleted note even if the undelete is successful.
|
show the undeleted note even if the undelete is successful.
|
||||||
|
|
||||||
|
|
|
@ -328,6 +328,12 @@ class Database( object ):
|
||||||
cache_key = sha.new( sql_command ).hexdigest()
|
cache_key = sha.new( sql_command ).hexdigest()
|
||||||
cache.delete( cache_key )
|
cache.delete( cache_key )
|
||||||
|
|
||||||
|
def uncache( self, obj ):
|
||||||
|
cache = self.__get_cache_connection()
|
||||||
|
if not cache: return
|
||||||
|
|
||||||
|
cache.delete( obj.cache_key )
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generate_id():
|
def generate_id():
|
||||||
int_id = random.getrandbits( Database.ID_BITS )
|
int_id = random.getrandbits( Database.ID_BITS )
|
||||||
|
|
|
@ -732,6 +732,7 @@ class Files( object ):
|
||||||
|
|
||||||
self.__database.execute( db_file.sql_delete(), commit = False )
|
self.__database.execute( db_file.sql_delete(), commit = False )
|
||||||
user = self.__users.update_storage( user_id, commit = False )
|
user = self.__users.update_storage( user_id, commit = False )
|
||||||
|
self.__database.uncache( db_file )
|
||||||
self.__database.commit()
|
self.__database.commit()
|
||||||
user.group_storage_bytes = self.__users.calculate_group_storage( user )
|
user.group_storage_bytes = self.__users.calculate_group_storage( user )
|
||||||
|
|
||||||
|
@ -919,6 +920,7 @@ class Files( object ):
|
||||||
# filesystem
|
# filesystem
|
||||||
for ( file_id, db_file ) in files_to_delete.items():
|
for ( file_id, db_file ) in files_to_delete.items():
|
||||||
self.__database.execute( db_file.sql_delete(), commit = False )
|
self.__database.execute( db_file.sql_delete(), commit = False )
|
||||||
|
self.__database.uncache( db_file )
|
||||||
Upload_file.delete_file( file_id )
|
Upload_file.delete_file( file_id )
|
||||||
|
|
||||||
self.__database.commit()
|
self.__database.commit()
|
||||||
|
|
Reference in New Issue