I think in general your approach is probably a better one - especially if there are a significant number of functions that are being proxied. The code you posted seems reasonable to my quick read, and could easily be applied to other wrappers.
However in this particular case I'm actually doing a little bit more in the forwarding-methods (keeping track of cache hits/misses, and verifying that some state is massaged appropriately).
I have updated the code here to work properly under strict + warnings, as you are utterly correct about the broken options hash being invalid.
About your last comment in the method renaming, you are correct. I only changed the names because I'm using a few singletons in my application and every other one uses disconnect - rather than disconnect_all, so it seemed natural to change it to match. On balance leaving its name alone seems best.
++ for the feedback.
In reply to Re^2: A singleton wrapper around Cache::Memcached
by skx
in thread A singleton wrapper around Cache::Memcached
by skx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |