[livejournal] r20818: LJSUP-10492: Incorrect working autosave ...
Committer: wisest-owl
LJSUP-10492: Incorrect working autosave for second timeU trunk/cgi-bin/LJ/User/PropStorage.pm U trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/User/PropStorage.pm
===================================================================
--- trunk/cgi-bin/LJ/User/PropStorage.pm 2011-12-20 11:13:44 UTC (rev 20817)
+++ trunk/cgi-bin/LJ/User/PropStorage.pm 2011-12-20 13:27:03 UTC (rev 20818)
@@ -73,6 +73,16 @@
Carp::croak $class . 'does not have a "memcache_key" method defined';
}
+sub delete_prop_memcache {
+ my ( $class, $u, $props ) = @_;
+
+ my $memkey = $class->memcache_key ($u, $props);
+
+ my $userid = int $u->userid;
+
+ LJ::MemCache::delete ([ $userid, $memkey ]);
+}
+
sub fetch_props_memcache {
my ( $class, $u, $props ) = @_;
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm 2011-12-20 11:13:44 UTC (rev 20817)
+++ trunk/cgi-bin/LJ/User.pm 2011-12-20 13:27:03 UTC (rev 20818)
@@ -3008,9 +3008,11 @@
sub uncache_prop {
my ($u, $name) = @_;
- my $prop = LJ::get_prop("user", $name) or die; # FIXME: use exceptions
- LJ::MemCache::delete([$u->{userid}, "uprop:$u->{userid}:$prop->{id}"]);
+
+ my $handler = LJ::User::PropStorage->get_handler ($name);
+ $handler->delete_prop_memcache ($u, $name);
delete $u->{$name};
+
return 1;
}
