Skip to content

Added LRU cache#16

Merged
msiemens merged 2 commits intomsiemens:masterfrom
eugene-eeo:lru-querycache
Jul 31, 2014
Merged

Added LRU cache#16
msiemens merged 2 commits intomsiemens:masterfrom
eugene-eeo:lru-querycache

Conversation

@eugene-eeo
Copy link
Contributor

Now queries are not popped at random from the cache but the least recently used is popped instead. This not only saves the database calculation time for frequently used queries but also makes sure that the less frequently used objects are freed. I.e.

table = db.table('table3', cache_size=1)
query = where('key') == 2

table.search(query)
table.search(where('key') == 1)

assert query not in table._queries_cache

@eugene-eeo
Copy link
Contributor Author

Don't merge it yet, I just remembered that I need to clear the cache on deletion.

msiemens added a commit that referenced this pull request Jul 31, 2014
@msiemens msiemens merged commit 908bb07 into msiemens:master Jul 31, 2014
@eugene-eeo eugene-eeo deleted the lru-querycache branch August 26, 2014 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants