summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-08 15:32:20 -0800
committerBrion Vibber <brion@pobox.com>2010-02-08 15:32:20 -0800
commit96ef4435b61570dbbf15d921a42543bfb13786c0 (patch)
treeea09a8d1e4d3dac2768335d97160bb479d11f9b1 /scripts
parent9cac8eaae5315f64e024d22119bc627e9bdd6141 (diff)
Allow scripts/decache.php to blow out cache for objects that don't exist (anymore).
May miss keys other than the given or primary key, but should work for a lot of common cases where a bad entry's been removed from DB but lingers in cache.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/decache.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/decache.php b/scripts/decache.php
index 7cabd78ad..094bdb5aa 100644
--- a/scripts/decache.php
+++ b/scripts/decache.php
@@ -24,6 +24,8 @@ $helptext = <<<ENDOFHELP
USAGE: decache.php <table> <id> [<column>]
Clears the cache for the object in table <table> with id <id>
If <column> is specified, use that instead of 'id'
+
+
ENDOFHELP;
require_once INSTALLDIR.'/scripts/commandline.inc';
@@ -43,8 +45,10 @@ if (count($args) > 2) {
$object = Memcached_DataObject::staticGet($table, $column, $id);
if (!$object) {
- print "No such '$table' with $column = '$id'.\n";
- exit(1);
+ print "No such '$table' with $column = '$id'; it's possible some cache keys won't be cleared properly.\n";
+ $class = ucfirst($table);
+ $object = new $class();
+ $object->column = $id;
}
$result = $object->decache();