in reply to How to keep an object between HTTP requests?
because the object takes long to initialize
Why is that? Are you trying to hold something that is not possibly serialized, and better not shared across threads, like a database handle, or is it just a very complex data structure?
If it's the former: don't do that. If it's a database handle, you might be able to make good use of a connection pool, see Apache::DBI.
If it's the latter, you might be successful in trying to use Memcached to temporarily hold the serialized (with Storable) object in memory, instead of saving it to a file. There are some good modules to interface to it, like Cache::Memcached (Pure Perl) and Cache::Memcached::Fast (XS). Note that Memcached may trow data away if it's running short on memory, so be prepared to recreate the object, if necessary.
|
|---|