Zend Framework Source Code Snippets

simple cache

Bookmark and Share
1
 
1
2
3
4
56
<?php
 
 
//bootstrap.php
require 'CacheAll.php';....
1
2
3
4
56
7
8
9
1011
12
13
14
1516
17
18
19
20
<?php
 require 'Zend/Cache.php';
    $frontendOptions = array(
               'lifetime' => 108000,
               'debug_header' => false, // for debugging set "true"               'default_options' => array(
                            'cache' => true,
                            'cache_with_get_variables' => true,
                            'make_id_with_get_variables' => true,
                            'cache_with_cookie_variables' => true,                            'make_id_with_cookie_variables' => true
              ),
           );
          $backendOptions = array(
                 'cache_dir' => '/path/to/dir',                 'hashed_directory_level' => 1,
                 'file_name_prefix' => 'npc',
           );
           $c = Zend_Cache::factory('Page', 'File', $frontendOptions, $backendOptions);
           $c -> start();

Comments

You must login before commenting on a snippet. If you do not have an account, please register.

Snippet description

simple exapmle of "non smart" cashing.
work perfectly in not to big sites

Snippet details

Created:
NikitaG NikitaG
12 months ago
Edited:
NikitaG NikitaG
12 months ago
Revision Id:
121
Edit Message:
Initial Release
ZF Version
1.8.3
Tags:
cache
Comments:
0
Views:
277
Points:
0 (0 votes)

History

r121

Initial Release

NikitaG NikitaG
12 months ago