mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-04-21 10:38 pm

[dw-free] investigate LJ::Blob, remove?

[commit: http://hg.dwscoalition.org/dw-free/rev/1198e89d8511]

http://bugs.dwscoalition.org/show_bug.cgi?id=1711

Remove userblobcache which is unused.

Patch by [personal profile] kareila.

Files modified:
  • bin/upgrading/base-data.sql
  • bin/upgrading/update-db-general.pl
  • cgi-bin/LJ/User.pm
  • cgi-bin/ljlib.pl
--------------------------------------------------------------------------------
diff -r 709e84fbdb8e -r 1198e89d8511 bin/upgrading/base-data.sql
--- a/bin/upgrading/base-data.sql	Wed Apr 21 10:25:03 2010 -0700
+++ b/bin/upgrading/base-data.sql	Wed Apr 21 22:38:56 2010 +0000
@@ -834,7 +834,6 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered.', '0', 'off', NULL, 's2stylelayers2');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered.', '0', 'off', NULL, 'sessions_data');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered.', '0', 'off', NULL, 'userbio');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered.', '0', 'off', NULL, 'userblobcache');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global table for persistent queues.', '0', 'off', NULL, 'persistent_queue');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global, indexed.', '0', 'off', NULL, 'userprop');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global, not indexed.', '0', 'off', NULL, 'userproplite');
diff -r 709e84fbdb8e -r 1198e89d8511 bin/upgrading/update-db-general.pl
--- a/bin/upgrading/update-db-general.pl	Wed Apr 21 10:25:03 2010 -0700
+++ b/bin/upgrading/update-db-general.pl	Wed Apr 21 22:38:56 2010 +0000
@@ -881,6 +881,7 @@ register_tabledrop("schools_attended");
 register_tabledrop("schools_attended");
 register_tabledrop("schools_pending");
 register_tabledrop("user_schools");
+register_tabledrop("userblobcache");
 
 register_tablecreate("infohistory", <<'EOC');
 CREATE TABLE infohistory (
@@ -2026,17 +2027,6 @@ CREATE TABLE loginlog (
 )
 EOC
 
-register_tablecreate("userblobcache", <<'EOC');
-CREATE TABLE userblobcache (
-    userid     INT UNSIGNED NOT NULL,
-    bckey      VARCHAR(60) NOT NULL,
-    PRIMARY KEY (userid, bckey),
-    timeexpire  INT UNSIGNED NOT NULL,
-    INDEX (timeexpire),
-    value    MEDIUMBLOB
-)
-EOC
-
 # global
 register_tablecreate("usertrans", <<'EOC');
 CREATE TABLE `usertrans` (
diff -r 709e84fbdb8e -r 1198e89d8511 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Wed Apr 21 10:25:03 2010 -0700
+++ b/cgi-bin/LJ/User.pm	Wed Apr 21 22:38:56 2010 +0000
@@ -1156,18 +1156,6 @@ sub begin_work {
 }
 
 
-sub cache {
-    my ($u, $key) = @_;
-    my $val = $u->selectrow_array("SELECT value FROM userblobcache WHERE userid=? AND bckey=?",
-                                  undef, $u->userid, $key);
-    return undef unless defined $val;
-    if (my $thaw = eval { Storable::thaw($val); }) {
-        return $thaw;
-    }
-    return $val;
-}
-
-
 # front-end to LJ::cmd_buffer_add, which has terrible interface
 #   cmd: scalar
 #   args: hashref
@@ -1503,17 +1491,6 @@ sub selfassert {
     LJ::assert_is( $u->user, $u->{_orig_user} )
         if $u->{_orig_user};
     return 1;
-}
-
-
-sub set_cache {
-    my ($u, $key, $value, $expr) = @_;
-    my $now = time();
-    $expr ||= $now + 86400;
-    $expr += $now if $expr < 315532800;  # relative to absolute time
-    $value = Storable::nfreeze($value) if ref $value;
-    $u->do("REPLACE INTO userblobcache (userid, bckey, value, timeexpire) VALUES (?,?,?,?)",
-           undef, $u->userid, $key, $value, $expr);
 }
 
 
diff -r 709e84fbdb8e -r 1198e89d8511 cgi-bin/ljlib.pl
--- a/cgi-bin/ljlib.pl	Wed Apr 21 10:25:03 2010 -0700
+++ b/cgi-bin/ljlib.pl	Wed Apr 21 22:38:56 2010 +0000
@@ -117,7 +117,7 @@ sub END { LJ::end_request(); }
                     "s2stylelayers2", "s2compiled2", "userlog",
                     "logtags", "logtagsrecent", "logkwsum",
                     "recentactions", "usertags", "pendcomments",
-                    "loginlog", "active_user", "userblobcache",
+                    "loginlog", "active_user",
                     "notifyqueue", "cprod", "blobcache",
                     "jabroster", "jablastseen", "random_user_set",
                     "poll2", "pollquestion2", "pollitem2",
--------------------------------------------------------------------------------