aporat
aporat

Reputation: 5932

In-Memory script cache backend in zend framework

I'm looking for solution for a in memory script cache, using Zend_Cache and zend framework.

We have a few cases in our application, that in order to display a table with, let's say, 100 elements, the logic is as the following:

In most cases, the user who approved the content is a 2 or 3 admin users, however the script calls the database / memecache multiple times. It gets worse, as the user model has to query 3 different tables to know which role the user belong to, and which community he also belongs to.

So all in all, to display a table of 100 items, we query the database (or memcache server) 600 times :-)

I was thinking about 2 solutions here:

We do use memcache server, but the script just queries the memcache server few hundred times instead of query the mysql database. It is faster to query the memcache server, however, as the script already loads this data, i want to use the script "memory" and not query an external server.

Upvotes: 1

Views: 739

Answers (1)

mabe.berlin
mabe.berlin

Reputation: 1083

Take a look at FaZend, there is an implementation of it. On taking a look into the code it should work a little bit different (e.g no TTL, test() returns a boolean) but it could be enough for you. Not tested !

Edit:

Since Zend Framework 2 there is an implementation for it: Zend\Cache\Storage\Adapter\Memory

Upvotes: 2

Related Questions