U
U
usja2011-05-10 17:36:44
Zend Framework
usja, 2011-05-10 17:36:44

Zend Cache and how to deal with a large number of cache files?

There is a project that is written in Zend. File Zend_Cache is used as caching.
Some cache entries contain data of 2-10 MB.
There are also various smaller ones.
The total number of cache files is ~ 5000.
With this amount, clearing the cache by tag, and, sometimes, reading data by the cache key sends the server Cache.php files (Zend Framework library) into deep thought.
How to be in this situation? Transfer cache from files to Memcache?

Tinctures:

$cacheBackendOptions = array(
'cache_dir' => APPLICATION_PATH . '/data/cache/',
'file_name_prefix' => 'klm',
'hashed_directory_level' => 2

);
$cache = Zend_Cache::factory('Core',
'File',
$cacheFrontendOptions,
$cacheBackendOptions);

* This source code was highlighted with Source Code Highlighter.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
Puma Thailand, 2011-05-10
@usja

Yes, you are right, give him a memcache, change the file system, cache not everything, but only the popular ones.

Z
zizop, 2011-05-11
@zizop

There are several options.
1. Leave the cache in the files, install an SSD :-)
2. Leave the HDD, move the cache to memcached/apc(shmop), it's good to switch the adapter in ZF.
By the way, why didn't you transfer the cache to Memcached earlier? legacy code?

U
usja, 2011-05-11
@usja

I understand that the whole problem is in the screw, or rather in the speed of reading?
In principle, there are 5-6 more sites on that server.

B
beono, 2011-05-11
@beono

2-10 MB is a lot. I dare to assume that there is no sense in such a cache, because. will spend a lot of time reading huge cache files. Can you there a lot of superfluous at a DB request?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question