-
Couldn't load subscription status.
- Fork 59
add cache_dir #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
add cache_dir #41
Conversation
rply/parsergenerator.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to add an isinstance(cache_dir, basestring) check before the isdir call but this doesn't seem to behave nicely with RPython. Any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is basestring really the correct type for paths? I think we should just pick unicode or bytes, whichever is correct, and use that.
|
I'd kind of prefer to come up with a better API, e.g. |
20e987a to
903a9e9
Compare
tests/test_parsergenerator.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be problematic, that is, on Travis in particular.
016f348 to
c7b9e7e
Compare
|
Working with the App engine #24 should be relatively simple. Something like the following (totally untested) code should work: class AppEngineCache(object):
VERSION=1
def __init__(self, cache_id):
self.cache_id = cache_id
def _get_key(self, grammar_hash):
return "rply-%s-%s-%s" % (self.VERSION, self.cache_id, grammar_hash)
def load(self, grammar_hash):
cache_key = self._get_key(grammar_hash)
memcache.get(cache_key, namespace="rply")
def dump(self, grammar_hash, data):
cache_key = self._get_key(grammar_hash)
memcache.set(cache_key, data, namespace="rply")
cache = AppEngineCache('myid')
ParserGenerator(["VALUE"], cache=cache) |
|
This conflicted with my other changes (in docs), so I've rebased on master. I think this is ready now |
caching still occurs when no cache_id is specified but is not persistent between restarts
|
Any word on this PR? |
|
@alex any updates on this? |
New Cache API