Project

General

Profile

Actions

Feature #21614

closed

Add support for MemCache

Added by Xavier Perseguers over 14 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Should have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2009-11-19
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

ADOdb supports MemCache for queries: http://phplens.com/lens/adodb/docs-adodb.htm#memcache

See how this may be used within DBAL and TYPO3.

(issue imported from #M12668)


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #23374: Add support for prepared queriesClosedXavier Perseguers2010-08-14

Actions
Actions #1

Updated by Xavier Perseguers about 14 years ago

Just as info here. I originally thought of something else when reading ADOdb documentation. But I finally gave it a try with something else.

A branch has been created:

https://svn.typo3.org/TYPO3v4/Extensions/dbal/branches/QueryCache

Basically what I (quickly) did is to store the complete query rewrite into MemCached. This is very very very experimental as no query are parametrized in Core, making MemCached store lots of "same" rewritten query again and again.

However on a demo site, this is way quicker once a query has been seen once before. Just test with EM and a click on an extension... It normally takes ages to show the details of the extension, but with this code, starting from second time showing the details of an extension, you end up having no more time to grab a cup of coffee during the loading process. Sorry :-)

To make a long story short, if we ever manage to start parametrize Core queries (by supporting parametrized queries in t3lib_db I'd say), this branch could become trunk and DBAL could start being possibly quite much more efficient.

Actions #2

Updated by Xavier Perseguers over 13 years ago

PDO syntax seems OK: http://api.drupal.org/api/group/database/7 (documentation from Drupal where they use it already)

Actions #3

Updated by Xavier Perseguers over 13 years ago

Branch QueryCache for DBAL has just been updated and synchronized with trunk:

http://forge.typo3.org/projects/extension-dbal/repository/show/branches/QueryCache

Have a look!

Actions #4

Updated by Xavier Perseguers over 13 years ago

To use it, edit localconf.php:

Without memcached (not optimal but already better than no caching):

$TYPO3_CONF_VARS['SYS']['useCachingFramework'] = 1;
$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['dbal'] = array(
'backend' => 't3lib_cache_backend_TransientMemoryBackend',
'options' => array(
),
);

Note: you may omit the configuration at all, as long as useCachingFramework is active, caching will default to t3lib_cache_backend_TransientMemoryBackend

For memcached, use:

$TYPO3_CONF_VARS['SYS']['useCachingFramework'] = 1;
$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['dbal'] = array(
'backend' => 't3lib_cache_backend_MemcachedBackend',
'options' => array(
'servers' => array('localhost:11211', 'otherhost:11211', 'thirdhost:11211'), // port is mandatory!
)
);

You need to have memcached installed as a daemon and also as a PHP extension!

Actions #5

Updated by Xavier Perseguers over 13 years ago

Branch QueryCache has been merge into trunk as revision 38370.

Actions

Also available in: Atom PDF