Created
March 19, 2013 20:06
-
-
Save fernandoflorez/5199604 to your computer and use it in GitHub Desktop.
jinja2 RedisBytecodeCache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RedisBytecodeCache(BytecodeCache): | |
def __init__(self, conn): | |
self._conn = conn | |
def load_bytecode(self, bucket): | |
code = self._conn.get(bucket.key) | |
if code is not None: | |
return bucket.bytecode_from_string(code) | |
def dump_bytecode(self, bucket): | |
self._conn.set(bucket.key, bucket.bytecode_to_string()) | |
def clear(self): | |
self._conn.delete(*self._conn.keys()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment