Hi everybody,

I use Zend_Cache with the "Core" Frontend and the "File" backend to
cache results (serialized arrays) of some database selects to files. I
have set the "hashed_directory_level" to 2.

The cache ids are build from the class name of the model and the method
name which includes the database select. Then all parameters of the
method are added. I use the underscore as a delimiter. Here are some
examples for my cache ids:

- Destination_Model_Main_fetchSuperiorDestinations_1
- Member_Model_Main_fetchMembersByDestination_1236_44_future
- Cms_Model_Menu_fetchContextMenu_de_destination_index_update
- Destination_Model_Main_fetchCountPerDestinationAndCategory_44

Besides these cache ids every cache file gets an tag similar to the
cache id, but only the main parameter passed to the method is used. For
my examples above the tags are:

- Destination_Model_Main_fetchSuperiorDestinations_1
- Member_Model_Main_fetchMembersByDestination_1236
- Cms_Model_Menu_fetchContextMenu_de
- Destination_Model_Main_fetchCountPerDestinationAndCategory_44

Now here is my problem. I have 10.000 and even many more cache files in
my data cache directory. They are separated into the 2-level directory
structure which Zend_Cache provides. Now when something happens that
needs a cache clearung (e.g. new forum post), the clearing of all cache
files for a specific tag takes a very long time (sometimes > 10 seconds).

I guess this is due to the fact, that Zend_Cache needs to read the whole
structure of my cache directory to identify all files with the specific
tag. Can someone confirm this? How can I improve my setup to solve this
performance issues?

One idea was to create one cache object for each class-method
combination (I have about 30 of these combinations) to minimize the
number of files that need to be accessed to find all cache files for a
specific tag. But I am not sure if this is the best solution.

Is Zend_Cache able to derive the directory structure from the cache id?
If yes, how?

I hope all of this doesn't sound too confusing and I am looking forward
for any help.

Thanks and Best regards,

Ralf

Reply via email to