[Slashdotjp-dev 1219] [747] Add feature storing RSS output into memcached

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2008年 9月 16日 (火) 22:47:56 JST


Revision: 747
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=747
Author:   tach
Date:     2008-09-16 22:47:56 +0900 (Tue, 16 Sep 2008)

Log Message:
-----------
Add feature storing RSS output into memcached

Modified Paths:
--------------
    slashjp/branches/2.5.0.192/Slash/XML/XML.pm
    slashjp/branches/2.5.0.192/debian/changelog


-------------- next part --------------
Modified: slashjp/branches/2.5.0.192/Slash/XML/XML.pm
===================================================================
--- slashjp/branches/2.5.0.192/Slash/XML/XML.pm	2008-09-16 12:46:01 UTC (rev 746)
+++ slashjp/branches/2.5.0.192/Slash/XML/XML.pm	2008-09-16 13:47:56 UTC (rev 747)
@@ -130,6 +130,26 @@
 		$opt = ($opt && $opt == 1) ? { Return => 1 } : {};
 	}
 
+	if ($opt->{mcdkey}) {
+		my $slashdb = getCurrentDB();
+		my $mcd = $slashdb->getMCD();
+		my $mcdkey = undef;
+		if ($mcd) {
+			$mcdkey = "$slashdb->{_mcd_keyprefix}:xmldcache:$type:$opt->{mcdkey}";
+			my $temp = $content;
+			if ($type =~ /^rss$/i) {
+				$temp =~ s|[dD]ate>[^<]+</||;
+			} elsif ($type =~ /^atom$/) {
+				$temp =~ s|updated>[^<]+</||;
+			}
+
+			$mcd->set($mcdkey, {
+				content	=> $content,
+				etag	=> md5_hex(encode_utf8($temp)),
+			});
+		}
+	}
+
 	if ($opt->{Return}) {
 		return $content;
 	} else {

Modified: slashjp/branches/2.5.0.192/debian/changelog
===================================================================
--- slashjp/branches/2.5.0.192/debian/changelog	2008-09-16 12:46:01 UTC (rev 746)
+++ slashjp/branches/2.5.0.192/debian/changelog	2008-09-16 13:47:56 UTC (rev 747)
@@ -13,8 +13,9 @@
   * Add plugins/Journal/journal_update_slashbox.pl to create topjournal blocks
   * Add feature to change redirect status code on redirect()
   * Redirect to new journal RSS URL
+  * Add feature storing RSS output into memcached
 
- -- Taku YASUI <tach****@osdn*****>  Tue, 16 Sep 2008 12:45:27 +0000
+ -- Taku YASUI <tach****@osdn*****>  Tue, 16 Sep 2008 13:46:13 +0000
 
 slash (2.5.0.192-16) unstable; urgency=low
 


Slashdotjp-dev メーリングリストの案内
アーカイブの一覧に戻る