memcaches_page 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -18,13 +18,15 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- Configuration:
21
+ ### Configuration
22
22
 
23
- `config.cache_store :dalli_store, ['memcache.dev:11211'], expires_in: 604800, namespace: "site"`
23
+ ```ruby
24
+ config.cache_store :dalli_store, ['memcache.dev:11211'], expires_in: 604800, namespace: "site"
25
+ ```
24
26
 
25
27
  Note, ensure compression isn't used, or if you do configure nginx to inflate it before serving.
26
28
 
27
- Caching:
29
+ ### Caching
28
30
 
29
31
  In your controller (or `ApplicationController`), simply include the module:
30
32
 
@@ -66,4 +68,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
66
68
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
67
69
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
68
70
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
69
- THE SOFTWARE.
71
+ THE SOFTWARE.
@@ -1,15 +1,15 @@
1
1
  module MemcachesPage
2
2
  extend ActiveSupport::Concern
3
3
  module ClassMethods
4
- def cache_page(content, path)
4
+ def cache_page(content, path, options={})
5
5
  return unless perform_caching
6
-
7
- Rails.cache.write path.gsub('%', '%25'), content, raw: true
6
+
7
+ Rails.cache.write path.gsub('%', '%25'), content, options.merge(raw: true)
8
8
  end
9
9
  end
10
-
11
- def cache_page(content = nil, options = nil)
12
- return unless self.class.perform_caching && caching_allowed?
13
- self.class.cache_page(content || response.body, request.fullpath)
10
+
11
+ def cache_page(content = nil, options = {})
12
+ return unless self.class.perform_caching && caching_allowed? && !request.params.key?('no-cache')
13
+ self.class.cache_page(content || response.body, request.fullpath, options)
14
14
  end
15
- end
15
+ end
@@ -5,7 +5,7 @@ Gem::Specification.new do |gem|
5
5
  gem.description = %q{Overrides caches_page and stores in memcached instead.}
6
6
  gem.summary = %q{Uses configuration from Rails cache store.}
7
7
  gem.homepage = ""
8
-
8
+
9
9
  gem.add_dependency("rails", "~> 3.1")
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
@@ -13,5 +13,5 @@ Gem::Specification.new do |gem|
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
14
  gem.name = "memcaches_page"
15
15
  gem.require_paths = ["lib"]
16
- gem.version = '0.1.2'
16
+ gem.version = '0.1.3'
17
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memcaches_page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-19 00:00:00.000000000 Z
12
+ date: 2012-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  version: '0'
63
63
  requirements: []
64
64
  rubyforge_project:
65
- rubygems_version: 1.8.22
65
+ rubygems_version: 1.8.23
66
66
  signing_key:
67
67
  specification_version: 3
68
68
  summary: Uses configuration from Rails cache store.