How can one cache a specific table to cache engine of his/her choice? Where and how you specify this info?

Comments

ajayg’s picture

Anybody? I am trying to see this setup for APC. I have installed cacherouter fine and it is caching "cache" tables fine. I am looking for a way if I could cache another highly used table as well.

jasonabc’s picture

looking for this also

crea’s picture

Status: Active » Fixed

Have you read README.txt shipped with the module ?

$conf['cacherouter'] = array(
  'default' => array(
    'engine' => 'db',
    'server' => array(),
    'shared' => TRUE,
    'prefix' => '',
    'path' => 'sites/default/files/filecache',
    'static' => FALSE,
    'fast_cache' => TRUE,
  ),
  'table_1' => array(
    ..
  ),
  'table_2' => array(
    ..
  ),
  ..
);
jasonabc’s picture

The README file does not contain that information. All it says is this:

$conf['cache_inc'] = './sites/all/modules/contrib/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
  'default' => array(
    'engine' => 'db',
    'servers' => array(),
    'shared' => TRUE,
    'prefix' => '',
    'path' => 'sites/default/files/filecache',
    'static' => FALSE,
    'fast_cache' => TRUE,
  ),
);

Thanks

Jason

crea’s picture

It is also said

All valid cache tables or "bins" can be added in addition, but you must have a default if you skip any bins.

so one could figure out that additional tables should be array items like "default".
But yes it could be a problem if one doesn't know PHP at all.

ajayg’s picture

Well My original request was how one go about caching a table which is not a typical "cached" table. SO for example how can I cache say user table so there is no trip to database?

crea’s picture

You would have to write a new module and patch core

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jvieille’s picture

Status: Closed (fixed) » Active

Still unclear to me. I might look dumb, but hopefully I am not alone...

1) If I need to cache a specific cache table, all I should do it to repeat this array be replacing "default" by the table name?

2) Witch tables can be cached? What are "valid cache tables"? What are "bins"?

3) What is actually cached with the "'default' => array(..."
According to the indications, cache tables are excluded by default?

4) what is the benefit of caching tables?

Thanks for de-dumbing me.

jvieille’s picture

Replying to myself to questions (1) and (3)

Here is my understanding after playing around Cacherouter

- the default setting takes care of the "cache" table only (+ probably a lot of other things)
The effect is that this table is automatically emptied and stays so as soon as Cacherouter is on.

- I added a section for each cache_* table (muti-site install)

'cache_something' => array(
'engine' => 'apc',
//'servers' => array(),
//'shared' => TRUE,
'prefix' => '8895b2mml',
'path' => 'sites/8895b2mml.net/files/filecache',
'static' => FALSE,
'fast_cache' => TRUE,
),

As a result, all these tables where emptied, so no cache tables are used anymore.

I suppose that Cacherouter manages to route the corresponding data to the proper cache engine (apc in my case)
I don't know if it has an effect on performances, but at least it keeps the database clean and lean

I would appreciate an opinion / advice / info on the lasting questions above

(2) Witch tables can be cached? What are "valid cache tables"? What are "bins"? (apart cache_ tables that I discovered are concerned)
(4) what is the benefit of caching tables?

Thanks

ajayg’s picture

My original question was about caching data which is not already in cache* tables. From what I understand the cacherouter just stores the "cached" data in memory/file instead of database. But there is no easy way (unless you code) to automatically cache existing tables data. (meaning there is no easy way to cache all user table data or session table data)

jvieille’s picture

What I observed is that cacherouter only caches the "cache" table, not other "cache_*"
Adding the corresponding sections makes it.

However, it would be nice to cache also temporary/non persistent data such as sessions, search_*, watchdog. Is it what you mean?
(I have 5Go of available apc cache memory which is merely 2% used...)

update: I tried to add search_* tables, but this does not seem to be taken into account