README.txt 2.73 KB
Newer Older
robertDouglass's avatar
robertDouglass committed
1 2
// $Id$

robertDouglass's avatar
robertDouglass committed
3
## INSTALLATION ##
4

lyricnz's avatar
lyricnz committed
5 6
To install, move memcache.inc to your DRUPAL/includes directory (where the
other *.inc files live).
7

lyricnz's avatar
lyricnz committed
8 9 10
The memcache.inc file is intended to be used instead of cache.inc, utilizing
Drupal's pluggable cache system. To make this happen, you need to update
$conf in settings.php to tell Drupal which cache_inc file to use:
11 12

 $conf = array(
lyricnz's avatar
lyricnz committed
13
   'cache_inc' => './includes/memcache.inc',
14 15
 );

robertDouglass's avatar
robertDouglass committed
16
## SERVERS ##
17

lyricnz's avatar
lyricnz committed
18 19 20 21 22
The available memcached servers are specified in $conf in settings.php. If
you do not specify any servers, memcache.inc assumes that you have a
memcached instance running on localhost:11211. If this is true, and it is
the only memcached instance you wish to use, no further configuration is
required.
robertDouglass's avatar
robertDouglass committed
23

lyricnz's avatar
lyricnz committed
24 25 26
If you have more than one memcached instance running, you need to add two
arrays to $conf; memcache_servers and memcache_bins. The arrays follow this
pattern:
robertDouglass's avatar
robertDouglass committed
27 28 29 30 31 32 33 34

'memcache_servers' => array(host1:port => cluster, host2:port => cluster, hostN:port => cluster)

'memcache_bins' => array(bin1 => cluster, bin2 => cluster, binN => cluster)

The bin/cluster/server model can be described as follows:

- Servers are memcached instances identified by host:port.
lyricnz's avatar
lyricnz committed
35 36 37 38 39

- Bins are groups of data that get cached together and map 1:1 to the $table
  param in cache_set. Examples from Drupal core are cache_filter,
  cache_menu. The default is 'cache'.

robertDouglass's avatar
robertDouglass committed
40
- Clusters are groups of servers that act as a pool.
lyricnz's avatar
lyricnz committed
41

robertDouglass's avatar
robertDouglass committed
42
- many bins can be assigned to a cluster.
lyricnz's avatar
lyricnz committed
43

robertDouglass's avatar
robertDouglass committed
44 45
- The default cluster is 'default'.

lyricnz's avatar
lyricnz committed
46 47 48 49
Here is an example configuration that has two clusters, 'default' and
'cluster2'. Five memcached instances are divided up between the two
clusters. 'cache_filter' and 'cache_menu' bins goe to 'cluster2'. All other
bins go to 'default'.
robertDouglass's avatar
robertDouglass committed
50 51 52

$conf = array(
  'cache_inc' => './includes/memcache.inc',
robertDouglass's avatar
robertDouglass committed
53 54 55 56
  'memcache_servers' => array('localhost:11211' => 'default',
                              'localhost:11212' => 'default',
                              '123.45.67.890:11211' => 'default',
                              '123.45.67.891:11211' => 'cluster2',
robertDouglass's avatar
robertDouglass committed
57 58
                              '123.45.67.892:11211' => 'cluster2'),

robertDouglass's avatar
robertDouglass committed
59 60
  'memcache_bins' => array('cache' => 'default',
                           'cache_filter' => 'cluster2',
lyricnz's avatar
lyricnz committed
61
                           'cache_menu' => 'cluster2'),
robertDouglass's avatar
robertDouglass committed
62 63 64
);

## PATCHES ##
65

lyricnz's avatar
lyricnz committed
66 67 68 69 70
No patches need to be applied. The patches that are currently part of the
DRUPAL-5--1.dev release should not be applied and will not be part of the
final release. Instead, a new module will be created, advanced_cache, which
will offer these patches as an advanced caching option for sites, with or
without memcache.
71

robertDouglass's avatar
robertDouglass committed
72
## MEMCACHE ADMIN ##
73

lyricnz's avatar
lyricnz committed
74 75
A module offering a UI for memcache is on the way. It will provide stats, a
way to clear the cache, and an interface to organize servers/bins/clusters.