witten
/
luminotes
Archived
1
0
Fork 0

When deleting file metadata from the database, also removing that data from the cache.

This commit is contained in:
Dan Helfman 2008-08-19 15:20:58 -07:00
parent 5afd5a4b73
commit 73219b74ce
3 changed files with 12 additions and 0 deletions

4
NEWS
View File

@ -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.

View File

@ -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 )

View File

@ -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()