Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Selecting one of two implementations

by dave0 (Friar)
on Apr 25, 2005 at 15:08 UTC ( #451224=note: print w/replies, xml ) Need Help??

in reply to Selecting one of two implementations

In the second implementation, your API does seem a bit complex. Why not:
$cache->insert( tag => $key_obj, data => $obj ); @values = $cache->retrieve( tag => $key_obj )
or even
$cache->insert( $key_obj, $obj ); @values = $cache->retrieve( $key_obj )
and let the cache object deal with constructing your tags from $key_obj? Then the chances of making a mistake when constructing the tag are limited to your cache code internals, rather than all the callers. You'll also be able to change your tag structure in one place should it become necessary.

Also, just curious here, but what did you find lacking in the Cache::* modules?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://451224]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2021-04-20 16:49 GMT
Find Nodes?
    Voting Booth?

    No recent polls found