Commit 2d8cab74 authored by robertDouglass's avatar robertDouglass

Id's all around

parent 71548cff
// $Id$
Fedora memcache + drupal walkthrough Fedora memcache + drupal walkthrough
1) Have a look at the background reading 1) Have a look at the background reading
A - http://www.danga.com/memcached/ (cache daemon) A - http://www.danga.com/memcached/ (cache daemon)
B - http://pecl.php.net/package/memcache (PHP integration for memcache) B - http://pecl.php.net/package/memcache (PHP integration for memcache)
...@@ -26,13 +28,13 @@ Fedora memcache + drupal walkthrough ...@@ -26,13 +28,13 @@ Fedora memcache + drupal walkthrough
1010 yum install php-devel 1010 yum install php-devel
1011 rpmbuild --rebuild php-pecl-memcache-2.0.4-1.rf.src.rpm 1011 rpmbuild --rebuild php-pecl-memcache-2.0.4-1.rf.src.rpm
3) Installed RPMS 3) Installed RPMS
[root@yoursite ~]# rpm -Uvh /usr/src/redhat/RPMS/x86_64/memcached-1.2.1-4.rf.x86_64.rpm /usr/src/redhat/RPMS/x86_64/php-pecl-memcache-2.0.4-1.rf.x86_64.rpm [root@yoursite ~]# rpm -Uvh /usr/src/redhat/RPMS/x86_64/memcached-1.2.1-4.rf.x86_64.rpm /usr/src/redhat/RPMS/x86_64/php-pecl-memcache-2.0.4-1.rf.x86_64.rpm
Preparing... ########################################### [100%] Preparing... ########################################### [100%]
1:php-pecl-memcache ########################################### [ 50%] 1:php-pecl-memcache ########################################### [ 50%]
2:memcached ########################################### [100%] 2:memcached ########################################### [100%]
[root@yoursite ~]# [root@yoursite ~]#
4) Verify configuration. Change if required. 4) Verify configuration. Change if required.
...@@ -51,7 +53,7 @@ Starting Distributed memory caching (memcached): [ OK ] ...@@ -51,7 +53,7 @@ Starting Distributed memory caching (memcached): [ OK ]
[root@yoursite ~]# service httpd restart [root@yoursite ~]# service httpd restart
Stopping httpd: [ OK ] Stopping httpd: [ OK ]
Starting httpd: [ OK ] Starting httpd: [ OK ]
[root@yoursite ~]# [root@yoursite ~]#
Check phpinfo() for memcached status. Mine said Check phpinfo() for memcached status. Mine said
...@@ -85,7 +87,7 @@ whole $cfg. The example below uses the default localhost:11211 server. ...@@ -85,7 +87,7 @@ whole $cfg. The example below uses the default localhost:11211 server.
$conf = array( $conf = array(
'memcache_inc' => './includes/memcache.inc', 'memcache_inc' => './includes/memcache.inc',
); );
[simon@yoursite memcache]$ [simon@yoursite memcache]$
8) Enable the drupal module from /admin/build/modules (it's in the "Other" 8) Enable the drupal module from /admin/build/modules (it's in the "Other"
section) section)
// $Id$
## INSTALLATION ## ## INSTALLATION ##
To install, move memcache.inc to your DRUPAL/includes directory (where the To install, move memcache.inc to your DRUPAL/includes directory (where the
...@@ -48,14 +50,14 @@ bins go to 'default'. ...@@ -48,14 +50,14 @@ bins go to 'default'.
$conf = array( $conf = array(
'cache_inc' => './includes/memcache.inc', 'cache_inc' => './includes/memcache.inc',
'memcache_servers' => array('localhost:11211' => 'default', 'memcache_servers' => array('localhost:11211' => 'default',
'localhost:11212' => 'default', 'localhost:11212' => 'default',
'123.45.67.890:11211' => 'default', '123.45.67.890:11211' => 'default',
'123.45.67.891:11211' => 'cluster2', '123.45.67.891:11211' => 'cluster2',
'123.45.67.892:11211' => 'cluster2'), '123.45.67.892:11211' => 'cluster2'),
'memcache_bins' => array('cache' => 'default', 'memcache_bins' => array('cache' => 'default',
'cache_filter' => 'cluster2', 'cache_filter' => 'cluster2',
'cache_menu' => 'cluster2'), 'cache_menu' => 'cluster2'),
); );
......
<?php <?php
// $ID$ // $Id$
global $_memcache_statistics; global $_memcache_statistics;
$_memcache_statistics = array('get' => array(), 'set' => array(), 'hit' => array()); $_memcache_statistics = array('get' => array(), 'set' => array(), 'hit' => array());
......
<?php <?php
// $Id$
/** /**
* Add serialized field to cache tables * Add serialized field to cache tables
......
// $Id$
// Global Killswitch // Global Killswitch
if (Drupal.jsEnabled) { if (Drupal.jsEnabled) {
$(document).ready(function() { $(document).ready(function() {
......
<?php <?php
// $Id$
function memcache_init() { function memcache_init() {
if (strstr($_SERVER['PHP_SELF'], 'update.php') || strstr($_GET['q'], 'autocomplete')) { if (strstr($_SERVER['PHP_SELF'], 'update.php') || strstr($_GET['q'], 'autocomplete')) {
......
<?php <?php
// $ID$ // $Id$
/* /*
* Some unit tests used while developing. You may find them instructional. * Some unit tests used while developing. You may find them instructional.
...@@ -395,4 +395,4 @@ function formatStats2($mc1, $mc2, $flush = FALSE) { ...@@ -395,4 +395,4 @@ function formatStats2($mc1, $mc2, $flush = FALSE) {
print "<tr><td>$count</td><td>". $stats1['bytes']. "</td><td>". $stats2['bytes']. "</td></tr>"; print "<tr><td>$count</td><td>". $stats1['bytes']. "</td><td>". $stats2['bytes']. "</td></tr>";
$count++; $count++;
} }
?> ?>
\ No newline at end of file
...@@ -126,7 +126,7 @@ function sess_regenerate() { ...@@ -126,7 +126,7 @@ function sess_regenerate() {
/** /**
* Counts how many users have sessions. Can count either anonymous sessions, authenticated sessions, or both. * Counts how many users have sessions. Can count either anonymous sessions, authenticated sessions, or both.
* Would be insane slow with memcached as we would need to retrieve at least the stats of all object. * Would be insane slow with memcached as we would need to retrieve at least the stats of all object.
* Not implemented. * Not implemented.
*/ */
function sess_count($timestamp = 0, $anonymous = true) { function sess_count($timestamp = 0, $anonymous = true) {
...@@ -156,4 +156,4 @@ function sess_gc($lifetime) { ...@@ -156,4 +156,4 @@ function sess_gc($lifetime) {
// to '1814400'. At that value, only after a user doesn't log in after // to '1814400'. At that value, only after a user doesn't log in after
// three weeks (1814400 seconds) will his/her session be removed. // three weeks (1814400 seconds) will his/her session be removed.
return TRUE; return TRUE;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment