Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • entries
    6
  • comments
    30
  • views
    6,880

коробочный cache


kJlukOo

648 views

 Share

использовать родной кеш можно следующим образом

$this->cache->get($key);
$this->cache->set($key);
$this->cache->delete($key);

настройки родного кеша хранятся тут system/config/default.php

по умолчанию в ocstore 2.3 кеш файловый, который живет один час

$_['cache_type']           = 'file'; // apc, file or mem
$_['cache_expire']         = 3600;

 

file       - файловый кеш (значения хранятся в файлах). ссдшник кстати поди ускоряет работу этого кеша

mem    - кеш хранящийся в оперативной памяти, етесно он быстрее чем файловый

apc      - честно не знаю, что это за тип, но гугл говорит - APC (Alternative PHP Cache) - бесплатный и открытый opcode кэшер для PHP.

 

инициализируется родной кеш в файле system/framework.php для того, чтобы он был доступен для использования в любом контроллере

$registry->set('cache', new Cache($config->get('cache_type'), $config->get('cache_expire')));

чтобы использовать своей кеш, который будет жить сутки, можно сделать так

 

$mycache = new Cache('file', 60*60*24);
$mycache->set('test',1);

кстати, для использования мемкеша нужно проводить дополнительные манипуляции с определением констант, которые в нем используются. это легко гуглится

 

 Share

0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.