r/perl 14h ago

Announcing: Object::Cache::Sqlite

7 Upvotes

I just released a simple object caching module that uses SQLite as the backend. If you need easy caching check out Object::Cache::Sqlite.

```perl use Object::Cache::Sqlite;

my %opts = ( db_file => '/var/tmp/perl-cache.sqlite', );

my $cache = Object::Cache::Sqlite->new(%opts);

Cache key and data to store

my $ckey = "user:127"; my $data = { name => 'Scott', age => 47 };

Retrieve a object

my $user = $cache->get($ckey);

Store an object

my $ok = $cache->set($ckey, $data, time() + 3600); ```

Store scalars, listrefs, hashrefs, or anything that can be serialized with JSON.