[Catalyst] using a persistent hash in a model

Perrin Harkins perrin at elem.com
Sat Jul 7 16:59:27 GMT 2007


On 7/7/07, Daniel McBrearty <danielmcbrearty at gmail.com> wrote:
> Is there any easy way to keep some ad-hoc persistent data out of the database?

Sure.  Most of them are either lossy or tricky to use, and tend to be
poor for concurrent reading/writing.

The obvious options are:
- BerkeleyDB.  Fast, but limited to one machine, and tricky to get
right because of insufficient docs for the advanced locking features.
Still, a good bet.
- Cache::FastMmap.  Fast, but lossy.  Will silently drop your data if
you go over the limit you set.  Limited to one machine.
- Cache::Memcached.  Fast (although much slower than BerkeleyDB or
Cache::FastMmap), but lossy.  Silently drops data if you go over the
limit you set.  Loses everything if the daemon is stopped for any
reason.  Works for a cluster though.

None of these have the same locking capabilities that a database does,
i.e. writers block readers and there's no easy way to do pessimistic
locking.  (I think BerkeleyDB supports pessimistic locking, but I
can't remember for sure.)

If you already have a database, using it will be easier than getting
any of these right.

- Perrin



More information about the Catalyst mailing list