Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Store data into dbm-style abstraction layer
Introduction
 uses the database (dbm-style)
abstraction layer
 store/ cache your objects, strings,
integers or arrays
 ...
Repository
 GitHub gjerokrsteski/php-dba-cache
 ZF-11073 Zend_Cache_Backend_Dba
 ZF2-139 ZendCacheStorageAdapterDba
8/2...
How it works
 dbm-style abstraction layer
 wraps dba_* functions
 Installation
 ./configure
--enable-dba=shared
--with...
DBA handlers
 cdb Tiny Constant Database = r
 cdb_make Tiny Constant Database = w
 db4 Oracle Berkeley DB 4 = rw
 qdbm...
Cache options
 open database
 insert, replace, get, delete record by key
 return metadata = expire + mtime
 get all ke...
Sweep options
 is optional
 clean all entries
 clean expired entries
 flush the cache/storage file
8/21/2013 7Gjero Kr...
DB 4 with persistent connection
$cache = new Cache(
'/your/path/to/cache-file.db4', 'db4'
);
$yorObject = new YourObjectYo...
Sweep in action
// For the garbage collection you can
// create for example an cron-job starting once a day
// or please u...
Cache Monitor
8/21/2013 10Gjero Krsteski
Have fun with it…
Gjero Krsteski
Programmer, Consultant, Trainer
Homepage: krsteski.de
E-Mail: gjero@krsteski.de
8/21/2013...
Upcoming SlideShare
Loading in …5
×

Php dba cache

1,856 views

Published on

The php-dba-cache uses the database (dbm-style) abstraction layer to cache/store
your PHP objects, strings, integers or arrays. Even instances of SimpleXMLElement
can be put to the cache. You dont have to matter about the size of the cache-file.
It depends on the free space of your disk.

Published in: Technology
  • Be the first to like this

Php dba cache

  1. 1. Store data into dbm-style abstraction layer
  2. 2. Introduction  uses the database (dbm-style) abstraction layer  store/ cache your objects, strings, integers or arrays  even instances of SimpleXMLElement  it depends on the free space of your disk 8/21/2013 Gjero Krsteski 2
  3. 3. Repository  GitHub gjerokrsteski/php-dba-cache  ZF-11073 Zend_Cache_Backend_Dba  ZF2-139 ZendCacheStorageAdapterDba 8/21/2013 3Gjero Krsteski
  4. 4. How it works  dbm-style abstraction layer  wraps dba_* functions  Installation  ./configure --enable-dba=shared --with-[handler] 8/21/2013 4Gjero Krsteski
  5. 5. DBA handlers  cdb Tiny Constant Database = r  cdb_make Tiny Constant Database = w  db4 Oracle Berkeley DB 4 = rw  qdbm Quick Database Manager = rw  gdbm GNU Database Manager = rw  inifile Ini File = rw  flatfile default = rw 8/21/2013 5Gjero Krsteski
  6. 6. Cache options  open database  insert, replace, get, delete record by key  return metadata = expire + mtime  get all keys 8/21/2013 6Gjero Krsteski
  7. 7. Sweep options  is optional  clean all entries  clean expired entries  flush the cache/storage file 8/21/2013 7Gjero Krsteski
  8. 8. DB 4 with persistent connection $cache = new Cache( '/your/path/to/cache-file.db4', 'db4' ); $yorObject = new YourObjectYouWantToPutInCache(); $yourObjectIdentifier = 'key:you:want'; // Check if your object is in the cache. // You also can ignore it, and let the CacheDba do it for you. if (false == $cache->has($yourObjectIdentifier)) { $cache->delete($yourObjectIdentifier); } $cache->put($yourObjectIdentifier, $yorObject); // Than somewhere at your project. $cache->get($yourObjectIdentifier); 8/21/2013 8Gjero Krsteski
  9. 9. Sweep in action // For the garbage collection you can // create for example an cron-job starting once a day // or please use the DBA-Cache-Monitor GUI. $sweep = new Sweep($cache); // clean all entries $sweep->all(); // or clean old entries – from now $sweep->old(); // or flush the whole storage! $sweep->flush(); 8/21/2013 9Gjero Krsteski
  10. 10. Cache Monitor 8/21/2013 10Gjero Krsteski
  11. 11. Have fun with it… Gjero Krsteski Programmer, Consultant, Trainer Homepage: krsteski.de E-Mail: gjero@krsteski.de 8/21/2013 Gjero Krsteski 11

×