[Catalyst] Plugin::Cache silent failures

Bill Moseley moseley at hank.org
Thu May 21 00:42:45 GMT 2009


sub cache_set {
    my ( $c, $key, $value, %meta ) = @_;
    $c->choose_cache_backend_wrapper( key =>  $key, value => $value, %meta )
        ->set( $key, $value, exists $meta{expires} ? $meta{expires} : () );
}


Unfortunately, Cache::Entry doesn't really specify a return value for
set(), but common backends like Memcached and FastMmap do seem to
return a value indicating success.  Not sure if there are other
commonly used backends that would not have a meaningful return value.

The plugin doesn't define the return from cache_set, either.
As it is now, cache_set can silently fail.

I wonder if it would be safe to warn on ->set() failing in the plugin.


-- 
Bill Moseley
moseley at hank.org
Sent from my iMutt




More information about the Catalyst mailing list