Hmm, I don“t get the parameter in the array, is there one cache entry per 
parameter?

 

$cachedFilter->call("filter", array('path1));

$cachedFilter->call("filter", array('path2));

 

Generates 2 cache entries?

 

 

Von: Julian Vidal [mailto:[email protected]] 
Gesendet: Mittwoch, 4. Juni 2014 10:22
An: Marc Tempelmeier
Cc: Zend Framework General
Betreff: Re: [fw-general] Zend\Cache\Pattern

 

There's one in the documentation but you need to scroll all the way down as the 
first example at the top only show how to create it and not saving and loading: 
http://framework.zend.com/manual/2.1/en/modules/zend.cache.pattern.object-cache.html

 

What's strange in this example is that this filter is so fast that it won't 
need caching but the idea is that you'd use this pattern while calling a method 
that takes a considerable time to execute.

 

$filter       = new Zend\Filter\RealPath();
$cachedFilter = Zend\Cache\PatternFactory::factory('object', array(
    'object'     => $filter,
    'object_key' => 'RealpathFilter',
    'storage'    => 'apc',
 
    // The realpath filter doesn't output anything
    // so the output don't need to be caught and cached
    'cache_output' => false,
));
 
$path = $cachedFilter->call("filter", array('/www/var/path/../../mypath'));
// OR
$path = $cachedFilter->filter('/www/var/path/../../mypath');

 

On Wed, Jun 4, 2014 at 4:07 AM, Marc Tempelmeier 
<[email protected]> wrote:

Can you provide a simple example for hmmm, the ObjectCache incl. saving and 
loading?

 

Von: Julian Vidal [mailto:[email protected]] 
Gesendet: Dienstag, 3. Juni 2014 23:17
An: Marc Tempelmeier
Cc: Zend Framework General
Betreff: Re: [fw-general] Zend\Cache\Pattern

 

The "storage" is just an adapter that saves the data in different locations 
depending on which adapter you use (disk, memcached, etc).

The patterns are much higher level and are designed to solve a specific caching 
problem. The one I use most often is the CaptureCache. It is designed to 
"capture" the output of a web page and store it into a file while keeping the 
directory structure the same as the url. The pattern uses a storage and not the 
other way around.

You could use just a storage to capture a web page but you'd have to code a lot 
more to generate the files, create the directory structure, etc, etc. That's 
what the pattern does.

Each pattern solves a specific high level problem if you will. Each storage 
just deals with saving your data and that's it.  

 

On Tue, Jun 3, 2014 at 9:03 AM, Marc Tempelmeier 
<[email protected]> wrote:

Hi,

what ist he purpose of the cache patterns?
How can I use them? When should I use the storage or the pattern?

Greetings

Marc

--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]

 

 

Reply via email to