[Slashdotjp-dev 1221] [749] Add feature to store/get polls RSS content from memcached

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2008年 9月 17日 (水) 12:04:47 JST


Revision: 749
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=749
Author:   tach
Date:     2008-09-17 12:04:47 +0900 (Wed, 17 Sep 2008)

Log Message:
-----------
Add feature to store/get polls RSS content from memcached

Modified Paths:
--------------
    slashjp/branches/2.5.0.192/Slash/Apache/User/User.pm
    slashjp/branches/2.5.0.192/debian/changelog
    slashjp/branches/2.5.0.192/plugins/PollBooth/pollBooth.pl


-------------- next part --------------
Modified: slashjp/branches/2.5.0.192/Slash/Apache/User/User.pm
===================================================================
--- slashjp/branches/2.5.0.192/Slash/Apache/User/User.pm	2008-09-16 14:36:00 UTC (rev 748)
+++ slashjp/branches/2.5.0.192/Slash/Apache/User/User.pm	2008-09-17 03:04:47 UTC (rev 749)
@@ -622,10 +622,6 @@
 		my @args = ($query);
 		if ($word =~ /^rss$/) {
 			push @args, "content_type=rss";
-			if ($constants->{rss_cachedir} && -r "$constants->{rss_cachedir}/pollBooth.rss") {
-				$r->filename("$constants->{rss_cachedir}/pollBooth.rss");
-				return OK;
-			}
 		} elsif ($word =~ /^(\d+)$/) {
 			push @args, "qid=$1";
 		}

Modified: slashjp/branches/2.5.0.192/debian/changelog
===================================================================
--- slashjp/branches/2.5.0.192/debian/changelog	2008-09-16 14:36:00 UTC (rev 748)
+++ slashjp/branches/2.5.0.192/debian/changelog	2008-09-17 03:04:47 UTC (rev 749)
@@ -14,9 +14,9 @@
   * Add feature to change redirect status code on redirect()
   * Redirect to new journal RSS URL
   * Add feature storing RSS output into memcached
-  * Add feature to store/get journal RSS content from memcached
+  * Add feature to store/get journal and polls RSS content from memcached
 
- -- Taku YASUI <tach****@osdn*****>  Tue, 16 Sep 2008 14:35:19 +0000
+ -- Taku YASUI <tach****@osdn*****>  Wed, 17 Sep 2008 03:04:03 +0000
 
 slash (2.5.0.192-16) unstable; urgency=low
 

Modified: slashjp/branches/2.5.0.192/plugins/PollBooth/pollBooth.pl
===================================================================
--- slashjp/branches/2.5.0.192/plugins/PollBooth/pollBooth.pl	2008-09-16 14:36:00 UTC (rev 748)
+++ slashjp/branches/2.5.0.192/plugins/PollBooth/pollBooth.pl	2008-09-17 03:04:47 UTC (rev 749)
@@ -31,8 +31,20 @@
 
         # hijack feeds
 	if ($form->{content_type} && $form->{content_type} =~ $constants->{feed_types}) {
+		my $mcd = $slashdb->getMCD();
+		if ($mcd) {
+			my $data = $mcd->get("$slashdb->{_mcd_keyprefix}:xmldcache:$form->{content_type}:pollBooth");
+			if ($data->{content}) {
+				http_send({
+					content_type	=> "application/$form->{content_type}+xml",
+					etag		=> ($data->{etag} || undef),
+					content		=> $data->{content},
+				});
+				return 1;
+			}
+		}
 		listpollsRSS($form, $slashdb, $constants);
-		return;
+		return 1;
 	}
 
 	my $op = $form->{op} && $ops{$form->{op}} ? $form->{op} : 'default';
@@ -403,6 +415,11 @@
 		$pollbooth_db->setPollQuestion($qid, { discussion => $discussion })
 			if $discussion && $discussion != $poll->{discussion};
 	}
+	my $mcd = $slashdb->getMCD();
+	if ($mcd) {
+		$mcd->delete("$slashdb->{_mcd_keyprefix}:xmldcache:rss:pollBooth", 1);
+		$mcd->delete("$slashdb->{_mcd_keyprefix}:xmldcache:atom:pollBooth", 1);
+	}
 	$slashdb->setStory($form->{sid}, { qid => $qid }) if $form->{sid};
 }
 
@@ -549,7 +566,7 @@
 		});
 	}
 
-	my $ret = xmlDisplay($form->{content_type} => {
+	xmlDisplay($form->{content_type} => {
 		channel			=> {
 			title		=> getData('rss_title'),
 			description	=> getData('rss_descr'),
@@ -563,8 +580,7 @@
 		items			=> $items,
 		rdfitemdesc		=> $constants->{dfitemdesc},
 		rdfitemdesc_html	=> $constants->{dfitemdesc_html} || 1,
-	}, $form->{ssi} ? 1 : 0);
-	print "$ret\n" if ($form->{ssi});
+	}, { mcdkey => 'pollBooth' });
 }
 
 #################################################################


Slashdotjp-dev メーリングリストの案内
Zurück zum Archiv-Index