[Jifty-commit] jifty branch, cas-memcached, updated. 409707d0b5faa01b126cb26aad4edea883a7c975
Jifty commits
jifty-commit at lists.jifty.org
Tue Jan 26 22:19:37 EST 2010
The branch, cas-memcached has been updated
via 409707d0b5faa01b126cb26aad4edea883a7c975 (commit)
from 57a4fcc33ad624d6004913cf80e0ee69775e5755 (commit)
Summary of changes:
lib/Jifty/CAS/Store/Memcached.pm | 24 +++++++++++++++++++++---
lib/Jifty/Config.pm | 2 +-
2 files changed, 22 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 409707d0b5faa01b126cb26aad4edea883a7c975
Author: Thomas Sibley <trs at bestpractical.com>
Date: Tue Jan 26 22:18:49 2010 -0500
Error check the memcached set calls
diff --git a/lib/Jifty/CAS/Store/Memcached.pm b/lib/Jifty/CAS/Store/Memcached.pm
index d7d5e84..9603a0e 100644
--- a/lib/Jifty/CAS/Store/Memcached.pm
+++ b/lib/Jifty/CAS/Store/Memcached.pm
@@ -44,7 +44,8 @@ sub memcached {
=head2 _store DOMAIN NAME BLOB
-Stores the BLOB (a L<Jifty::CAS::Blob>) in memcached. Returns the key.
+Stores the BLOB (a L<Jifty::CAS::Blob>) in memcached. Returns the key on
+success or undef on failure.
=cut
@@ -53,8 +54,25 @@ sub _store {
# Default to expiring in two weeks. XXX TODO this should be configurable
my $key = $blob->key;
- $class->memcached->set("$domain:db:$key", $blob, 60*60*24*14);
- $class->memcached->set("$domain:keys:$name", $key, 60*60*24*14);
+ my $success = $class->memcached->set("$domain:db:$key", $blob, 60*60*24*14);
+
+ unless ($success) {
+ my $err = "Failed to store content for key '$domain:db:$key' in memcached!";
+ {
+ use bytes;
+ $err .= " Content length is: " . length($blob->content) . " bytes.";
+ $err .= " Perhaps you need to increase memcached's max item size?";
+ }
+ Jifty->log->error($err);
+ return;
+ }
+
+ $success = $class->memcached->set("$domain:keys:$name", $key, 60*60*24*14);
+
+ unless ($success) {
+ Jifty->log->error("Failed to store key '$domain:keys:$name' in memcached!");
+ return;
+ }
return $key;
}
diff --git a/lib/Jifty/Config.pm b/lib/Jifty/Config.pm
index f2c4433..fbbf046 100644
--- a/lib/Jifty/Config.pm
+++ b/lib/Jifty/Config.pm
@@ -619,7 +619,7 @@ sub defaults {
Memcached => {
servers => [ '127.0.0.1:11211' ],
debug => 0,
- namespace => $self->framework('ApplicationName'),
+ namespace => $self->framework('ApplicationName').":",
compress_threshold => 10240,
},
},
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list