Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Plugin::Cache silent failures

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


moseley at hank

May 20, 2009, 5:42 PM

Post #1 of 2 (346 views)
Permalink
Plugin::Cache silent failures

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


_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


bobtfish at bobtfish

May 23, 2009, 8:13 AM

Post #2 of 2 (278 views)
Permalink
Re: Plugin::Cache silent failures [In reply to]

Apologies for the delay, I'm a little behind on things this week..

Bill Moseley wrote:
> 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.

It's useful to know the return value in some cases, so I'm all for a
patch which propagates that.

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

I think for the common case, this is probably good behavior, however I
think there should be a config setting which could disable this warning..

Patches for both of the above would be welcome.

Cheers
t0m



_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.