From: <nul...@cl...> - 2012-03-28 09:36:25
|
SHIBATA Hiroshi 2012-03-26 22:41:07 +0900 (Mon, 26 Mar 2012) New Revision: 4e6ec00617708a630379740f395444a7871ca33a Merged 97f35d3: Merge pull request #143 from hsbt/memcached Log: impl restore_cache Modified files: tdiary.rb tdiary/io/default.rb Modified: tdiary.rb (+2 -3) =================================================================== --- tdiary.rb 2012-03-26 22:32:09 +0900 (056c946) +++ tdiary.rb 2012-03-26 22:41:07 +0900 (1480689) @@ -184,9 +184,8 @@ module TDiary load_plugins # load and apply rhtmls - if @io.cache_enable?( prefix ) && @conf.io_class.to_s == 'TDiary::DefaultIO' - r = File::open( "#{@io.cache_path}/#{@io.cache_file( prefix )}" ) {|f| f.read } rescue nil - end + r = @io.restore_cache( prefix ) + if r.nil? files = ["header.rhtml", @rhtml, "footer.rhtml"] rhtml = files.collect {|file| Modified: tdiary/io/default.rb (+6 -0) =================================================================== --- tdiary/io/default.rb 2012-03-26 22:32:09 +0900 (07b9e6f) +++ tdiary/io/default.rb 2012-03-26 22:41:07 +0900 (f8a0383) @@ -275,6 +275,12 @@ module TDiary end end + def restore_cache( prefix ) + if cache_enable?( prefix ) && @tdiary.conf.io_class.to_s == 'TDiary::DefaultIO' + File::open( "#{@io.cache_path}/#{@io.cache_file( prefix )}" ) {|f| f.read } rescue nil + end + end + def store_cache( cache, prefix ) unless FileTest::directory?( cache_path ) then begin |