jonswar/perl-chi — Issue #5: Feature request - active method for cache instance
Author: Perlover
Created: 2011-11-03 15:40:22+00:00
State: open

Good day!

I want to prevent storm of 'compute' method if i have CHI & Memcached and if Memcached is not working already during runtime. Now a get & set methods of Memcached's modules don't die if connection is dropped. And i will not know in program code if memcached will die - no die from theirs - no errors in CHI (CHI catches errors from drivers through die from get & set)...

If i use compute method that after if memcached will die i will get a big problems - every time my $code of compute will run again & again -> i will get a snowball effect.

I think better way will introduce new method for cache instance - 'active' - if our driver of cache functions properly (for memcached this status of connect but i didn't find it there now - i will ask the author of Cache::Memcached::Fast & Cache::Memcached to add it) active will return true else false. If this method will be i will be able to check this status inside 'compute' and if status is not active - rise error through die or to return undef.

There is other way may be. To ask an authors of Cache::Memcached* modules to add die from get & set as an option.

What is your opinion?

Thanks