[Catalyst] clear() method for Catalyst::Plugin::Cache?

Larry Leszczynski larryl at emailplus.org
Sat Mar 7 00:42:20 GMT 2009


Does it make sense to add a clear() method to Catalyst::Plugin::Cache,
in addition to the existing get(), set() and remove()?  It seems like a
common action for cache manipulation.

Any of the various Cache::Cache-based backend flavors should be able to
support it out of the box.  For specific backends that use a different
method name to accomplish clearing the cache (e.g.
Cache::Memcached::libmemcached::flush_all), would need to come up with a
way to map method names - maybe a config option?:

    __PACKAGE__->config->{'Plugin::Cache'}{backend} = {
        class   => "Cache::Memcached::libmemcached",
        method_map => {
                       clear => 'flush_all',
                      },
        servers => ['127.0.0.1:11211'],
        debug   => 2,
    };
?

I can try to work up patches if there's a consensus that it makes sense
to do...

Larry



More information about the Catalyst mailing list