Skip Menu |
 

This queue is for tickets about the CHI CPAN distribution.

Report information
The Basics
Id: 32921
Status: resolved
Priority: 0/
Queue: CHI

People
Owner: Nobody in particular
Requestors: justin [...] techadvise.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.05
Fixed in: (no value)



Download (untitled) / with headers
text/plain 1.1k
Are there plans to implement namespace operations fully into CHI? When I think of being able to work with namespaces in a cache, I think of doing the following: my $cache = CHI->new(%opts); $cache->add_namespace("objects_by_primary_key"); # Do some stuff... $cache->add_namespace("primary_keys_by_unique_keys"); #Do some stuff... $cache->set_namespace("objects_by_primary_key"); #Makes all further cache methods operate on the objects_by_primary_key namespace only $cache->clear; #Clears only objects in the objects_by_primary_key namespace Currently, many of the drivers don't support this type of namespace operations, so you'd have to write some wrapper functions that kept track of which objects were on which namespace. Just wanting to get a feel if this was one of the goals of CHI or not. The benefit here is that I can specify one large cache, and let the LRU algorithm figure out what stays cached and what doesn't. I don't have to mess with separate cache objects. I'm trying to write a CHI module for Rose::DB::Object and these features would make a lot of sense. I can work around them, but it would be nice to see them in CHI.
Download (untitled) / with headers
text/plain 1.7k
The namespace API is designed so that a given cache object can optimize for working with a single namespace. For example, each FastMmap or BerkeleyDB object can keep a single file open for its namespace. $cache->clear() can be implemented simply by deleting the file, and $cache->get_keys() can be implemented by scanning the file. Don't really plan to change the namespace concept, but I could imagine a second concept living alongside it, for example a key prefix that gets added automatically to every get and set... On Mon Feb 04 12:49:41 2008, justintime wrote: Show quoted text
> Are there plans to implement namespace operations fully into CHI? When > I think of being able to work with namespaces in a cache, I think of > doing the following: > > my $cache = CHI->new(%opts); > $cache->add_namespace("objects_by_primary_key"); > # Do some stuff... > $cache->add_namespace("primary_keys_by_unique_keys"); > #Do some stuff... > $cache->set_namespace("objects_by_primary_key"); #Makes all further > cache methods operate on the objects_by_primary_key namespace only > $cache->clear; #Clears only objects in the objects_by_primary_key
namespace Show quoted text
> > Currently, many of the drivers don't support this type of namespace > operations, so you'd have to write some wrapper functions that kept > track of which objects were on which namespace. > > Just wanting to get a feel if this was one of the goals of CHI or not. > The benefit here is that I can specify one large cache, and let the LRU > algorithm figure out what stays cached and what doesn't. I don't have > to mess with separate cache objects. > > I'm trying to write a CHI module for Rose::DB::Object and these features > would make a lot of sense. I can work around them, but it would be nice > to see them in CHI.
Download (untitled) / with headers
text/plain 281b
In the latest CHI (0.36) you can override transform_key in your drivers to, for example, add your own namespace prefix. That will let you work with multiple pseudo-namespaces with the same CHI object. The core namespace support in CHI is going to remain the way it is. Thanks! Jon


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.