ZF-11073: Zend_Cache_Backend_Dba
Description
Based on php-dba-cache a have writen a "Zend_Cache_Backend_Dba" class. The php-dba-cache uses the database (dbm-style) abstraction layer to cache your objects, strings, integers or arrays. Even instances of SimpleXMLElement can be puted to the cache. I just wrote the Class "Zend_Cache_Backend_Dba" for my company, and it works fine. More information about php-dba-cache you can find at https://github.com/gjerokrsteski/php-dba-cache
I allso can see the "Zend_Cache_Backend_Dba" class at https://github.com/gjerokrsteski/… for inspection.
Best regards, Gjero Krsteski
Comments
Posted by Marc Bennewitz (private) (mabe) on 2011-03-02T12:30:11.000+0000
Hi Giero,
That's an very interesting idea !
But please note the following:
Greetings
Posted by Gjero Krsteski (gjerokrsteski) on 2011-03-03T01:52:53.000+0000
Hi Marc,
thanks for the answer. I already sent the CLA by fax and e-mail. See here, i just wrote an dba-backend-cache https://github.com/gjerokrsteski/…
Posted by Marc Bennewitz (private) (mabe) on 2011-03-25T17:39:45.000+0000
HI Gjero,
I impemented a dba adapter for ZF2 to see how it works an find issues: https://github.com/marc-mabe/zf2/…
One think i have found is described @ http://bugs.php.net/bug.php?id=54242 But I can't test all available handlers :( It would be nice if you can could take a look into it and run some more tests with different handlers.
Feel free to backport this version back to ZF1 (without the Cache*-Classes).
Posted by Gjero Krsteski (gjerokrsteski) on 2011-04-01T09:10:00.000+0000
Hi Marc,
thanks for the report. In the next two weeks i will backport your fix of the Bug #54242. There is something you have to know about the DBA-style databases, like not all of the databases can replace key-value pairs, like the CDB. The CDB database can handle onlly with fixed key-vaue pairs. The best and fastest handlers for DBA-style caching are: QDBM, Berkeley DB (DB4), NDBM and least the Flatfile. Why you are trying to re-insert instead of replace the value?
p.s. can you send me the url tho the ZF1 SVN-branch for the backport?
Posted by Marc Bennewitz (private) (mabe) on 2011-04-02T15:51:04.000+0000
??Why you are trying to re-insert instead of replace the value???
dba_insert: If this key already exist in the database, this function will fail. dba_replace: replaces or inserts the entry
Therefor the adapter works as follows: setItem: -> dba_replace addItem: -> dba_insert + workaround for Bug #54242 replaceItem: -> dba_exists + dba_replace
I don't have a backport for ZF1, yet. For now I don't have enough time to implement new features to ZF1 :( If you have SVN-Access you can create a branch @ http://framework.zend.com/svn/framework/… or create a clean backport on github that can be simply added as one backend file to ZF1.
I read your implementation for ZF1 on github but this requires 3 more classes which are not needed for ZF. Additionally serialization is done on frontend and the backend have to handle strings only. You could store the time within that string using the pack function ;)
Posted by Marc Bennewitz (private) (mabe) on 2011-04-02T15:54:15.000+0000
Changed assignee to Gjero
Posted by Gjero Krsteski (gjerokrsteski) on 2011-04-21T04:23:25.000+0000
You can find the backport on github. I just keep the additional serialization, because i have some additional data, which is important for the caching. Please give me an review.
Posted by Marc Bennewitz (private) (mabe) on 2011-05-03T21:19:00.000+0000
Some small Notices/Questions:
Posted by Gjero Krsteski (gjerokrsteski) on 2011-09-08T19:10:40.000+0000
Hi Marc,
Thank you for your comment. I've implemented all your improvements. Check it out on github, and please give me a new recognition.
Posted by Marc Bennewitz (private) (mabe) on 2011-09-09T17:29:28.000+0000
Hi Gjero,
Thank you for your work. I have looked into it and the most looks great but two points from above I'm missing:
... but you have to return a boolean false if the item doesn't exist and the last modification time of the item else.
Posted by Gjero Krsteski (gjerokrsteski) on 2011-09-10T14:59:08.000+0000
Hi Marc,
thank you for the recognition.
to 5.) I implemented it as you wrote. see it on github. to 6.) A simple serialize/unserialize isn't enough, because I made the experience that a lot of people use ZF1 only as library and put any type of data into the cache. By this implementation you can use it in your ZF1-application and handle with strings, and on the other hand you can use it as library and put any types of data into the cache.
p.s. which is the official ZF1 repository on github?
Posted by Marc Bennewitz (private) (mabe) on 2012-01-09T20:30:27.000+0000
Cloned for ZF2 see ZF2-139