Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (21 sloc) 0.691 kb
import sql_cache
# setup the database
sql_cache.set_DB(db='db', user='user', passwd='passwd')
# setup cache size
sql_cache.MAX_SIZE = 10000
# make the cache table, drop it if it already exists
# set some key value pairs
sql_cache.set('query_1', [1,2,3])
sql_cache.set('query_2', 'a string', sticky=True)
sql_cache.set('query_3', {'a':1, 'b':2, 'c':3})
# returns {'a':1, 'b':2, 'c':3}
print sql_cache.get('query_3')
# returns 'a string'
print sql_cache.get('query_2')
# clears the entire but not the sticky values
# returns None
print sql_cache.get('query_1')
# returns 'a string'
print sql_cache.get('query_2')
Jump to Line
Something went wrong with that request. Please try again.