OSDN Git Service

Plugin::Preprocessor: get_content() support {reload => 1} option
authorhylom <hylom@users.sourceforge.jp>
Tue, 5 Mar 2019 14:34:40 +0000 (23:34 +0900)
committerhylom <hylom@users.sourceforge.jp>
Tue, 5 Mar 2019 14:34:40 +0000 (23:34 +0900)
src/newslash_web/lib/Newslash/Plugin/Preprocessor.pm

index bef4f43..a8a1cac 100644 (file)
@@ -215,11 +215,16 @@ sub rebuild {
 }
 
 sub get_content {
-    my ($self, $path) = @_;
-    my $content = $self->{app}->ccache->hash_get(CACHE_KEY, $path);
-    if ($content) {
-        # decode content body
-        $content->{content} = Encode::decode_utf8($content->{content});
+    my ($self, $path, $options) = @_;
+    $options ||= {};
+    my $content;
+
+    if (!$options->{reload}) {
+        $content = $self->{app}->ccache->hash_get(CACHE_KEY, $path);
+        if ($content) {
+            # decode content body
+            $content->{content} = Encode::decode_utf8($content->{content});
+        }
     }
 
     if (!$content) {