![]() |
![]()
| ![]() |
![]()
NAMEJifty::CAS - Jifty's Content-Addressable Storage facility SYNOPSISmy $key = Jifty::CAS->publish('js' => 'all', $content, { hash_with => $content, # default behaviour content_type => 'application/x-javascript', }); $ie_key = Jifty::CAS->publish('js' => 'ie-only', $ie_content, { hash_with => $ie_content, content_type => 'application/x-javascript', }); $key = Jifty::CAS->key('js', 'ie-only'); my $blob = Jifty::CAS->retrieve('js', $key); DESCRIPTIONProvides an in-memory "md5"-addressed content store. Content is stored under a "domain", and can be addressed using wither the "key", which is an "md5" sum, or the "name", which simply stores the most recent key provided with that name. BACKENDSThe default data store is a per-process, in-memory store via Jifty::CAS::Store::Memory. Jifty::CAS::Store::Memcached is also available, and has the benefits of sharing the cache across all instances of a Jifty app using Jifty::CAS. The memcached store is limited to objects less than 1MB in size, however. Jifty::CAS::Store::LocalFile provides a durable store, which is well-suited for sharing the cache across instances and restarts. Because of its speed, however, Jifty::CAS::Store::Nested is suggested to provide a layered cache, most probably with fast memory-based cache in front of a durable, file-based cache. METHODSpublish DOMAIN NAME CONTENT METADATAPublishes the given "CONTENT" at the address "DOMAIN" and "NAME". "METADATA" is an arbitrary hash; see Jifty::CAS::Blob for more. Returns the key on success, or undef on failure. key DOMAIN NAMEReturns the most recent key for the given pair of "DOMAIN" and "NAME", or undef if none such exists. retrieve DOMAIN KEYReturns a Jifty::CAS::Blob for the given pair of "DOMAIN" and "KEY", or undef if none such exists. uri DOMAIN NAMEReturns a URL where the given "DOMAIN" and "NAME" can be accessed. serve DOMAIN ARGUMENT ENVServes a plack request in "ENV", given a "DOMAIN" and an "ARGUMENT", which may wither be a key or a name. This method is usually only called by "wrap", which calls it as appropriate for all requests under "/__jifty/cas/". backend [DOMAIN]Returns the Jifty::CAS::Store which backs the given "DOMAIN". If "DOMAIN" is not specified, returns the default backing store. configReturns the CAS configuration, as specified in the framework's configuration. setupConfigures the CAS for use. wrap APPGiven a PSGI application, wraps it to handle "/__jifty/cas/" requests by calling the appropriate "serve" method.
|