Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Selecting one of two implementations

by dave0 (Friar)
on Apr 25, 2005 at 15:08 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (8)
As of 2024-09-17 22:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (22 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.