On Sat, Feb 21, 2009 at 12:03 AM, Jared Johnson <jar...@nmgi.com> wrote:
> Some things I'm not so sure about: > > - Two hooks, one for retrieval and one for storage? I think that's probably > the way to go I like the second-argument-means-replace semantics of the notes function, and like "pnotes" more than "store" since "store seems like a lower-level thing, as STORE and FETCH are the tie methods. > - Do we always pass a possible address object to the hooks? Or do we leave > it out and let people manually muck with their keys? It seems to me that it > would be very useful to give people means to construct keys in interesting > ways without having to expose that on the caller end; but is this the best > way to do so? You could go as far as to allow *any* number of arguments, > which get passed to the hook, which takes the last argument as the value and > uses the rest after $self and $transaction to construct the key. That would > probably a bit overboard, but maybe there are other ideas. > > Thoughts? with a key,value interface, allowing the key to be an array-ref would give the any-number-of-keys thing without sacrificing the second-arg-is-replacement-value thing. > And, just out of curiosity, where would DirDB be more appropriate to use > than memcached or Cach::FastMmap? > > -Jared DirDB is appropriate when you want a hash interface like C<opendbm> but you need to share the store amongst multiple processes and you don't particularly care about serialization but you want a guarantee that anything read will be a complete value that was written and you have enough inodes to make a new file for every row of your data and don't mind using the file system's caching policy. When you don't want to bother setting up something better; when you want a simple persistence layer using one file per row immediately, for prototyping. There could be a persistence_register hook, describing the schema of the data that will be used by the plugin, and what lexical variables to tie it to. -- Freedom's colors are red, white and black and blue.