NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Nice (Score:1)
I've been wanting to add a caching layer to my app but one thing I've been pondering on is handling different objects in the same cache.
I know the common solution is to prepend the object name to the key but it would be nice if this was abstracted by the cache layer itself. Perhaps an optional objectspace parameter could be added to the get/set methods? Or how about something like:
Re:Nice (Score:1)
There is already support for multiple namespaces, but I take it that's not what you're looking for.
I've been considering adding support for complex keys that are automatically serialized, so you could say:
my $customer = $cache->get({customer => $name}); $cache->set({customer => $name}, $customer, "10 minutes" ); my $user = $cache->get({user => $name});which is maybe a little cleaner than prepending onto a string...
Reply to This
Parent
Re: (Score:1)
Sorry, that should have read:
Re: (Score:1)
I like the complex key idea, though.