Hello,
I'm trying to setup some caching with "beaker.cache" for my expensive
users/groups/privileges database retrieval process. But there seem to be
a bug when testing the keys in the cache:
# Setup a "users" container and set (key, value) pair
>>> cache.get_cache("users").set_value("anonymous", model.User())
# Test using use the "has_key" method
>>> cache.get_cache("users").has_key("anonymous")
False
>>> cache.get_cache("users").has_key("foo")
0
# and try with "in"
>>> "anonymous" in cache.get_cache("users")
False
>>> "foo" in cache.get_cache("users")
False
# And now try to retrieve the data.
>>> cache.get_cache("users").get_value("anonymous")
<mp.models.users.User object at 0x13f2e50>
# So I use the try/except hack to work it around
>>> try:
... cache.get_cache("users").get_value("foo")
... except KeyError, e:
... "Key not found: %s" % e
...
"Key not found: 'foo'"
Trying to look at the source code, it seems it goes down to the
container object (in this case "DBMContainer"), which is in the package
MyghtyUtils, which is a single, unreadable, .egg file here.
Using:
- Beaker-0.6.3-py2.4.egg
- MyghtyUtils-0.52-py2.4.egg
Regards,
--
Alexandre CONRAD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---