coffee_table 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.textile +5 -7
- data/changelog.txt +3 -2
- data/lib/coffee_table/version.rb +1 -1
- data/lib/coffee_table.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8f7ff652cc590e6c9a33a97628fa5f7c97be1ac
|
4
|
+
data.tar.gz: ee7d71355ae8cae5bbc822a7d8fb82c3a57e173c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 289f04effa492d9d354f44bd624b6c65a3c7c9f7a7db502a540470a3978046587ea59692d6f49d979450a545e0a80a2d621dec469e62b069b090e78a493572fb
|
7
|
+
data.tar.gz: 7dff15d4cd9c9a800c1349947dbcbeb56fc85257723955c918ff7e27e36c37ac3f154b7f8475824145e1900b4a0c5ad743b64f3e25941cc170a4aaf10fc0e886
|
data/Gemfile.lock
CHANGED
data/README.textile
CHANGED
@@ -5,10 +5,10 @@ h1. CoffeeTable v0.1.1
|
|
5
5
|
!https://gemnasium.com/stewartmckee/coffee_table.png!
|
6
6
|
!https://coveralls.io/repos/stewartmckee/coffee_table/badge.png?branch=master(Coverage Status)!:https://coveralls.io/r/stewartmckee/coffee_table
|
7
7
|
|
8
|
-
h2. Intro
|
9
|
-
|
8
|
+
h2. Intro
|
9
|
+
|
10
10
|
CoffeeTable is a smart fragment caching gem that was born out of a frustration with the standard caching methods. Maintaining the cache keys constantly was a headache and 'bet its a caching issue' was a phrase uttered way too much. CoffeeTable was designed to take on the role of maintaining the cache keys for you, allowing you to concentrate on what is in the cache. It works by maintaining a list of its keys in a known format and when expiry is required for an object it knows which ones to expire. It also hopefully will be a perfromance boost for some cases where you are being overly cautious about clearing cache, a more targeted approach will improve performance.
|
11
|
-
|
11
|
+
|
12
12
|
h3. Installation
|
13
13
|
|
14
14
|
h4. Using Rails/Bundler
|
@@ -38,11 +38,11 @@ Creates a new cache object. You can pass options into this method to modify the
|
|
38
38
|
* :ignore_code_changes defaults to false. By default a md5 hash of the code in the block is included in the key, if you change the code, the key automatically invalidates. This is to protect against code changes that won't be picked up due to the cache returning.
|
39
39
|
* :compress_content defaults to true and sets whether large strings are compressed
|
40
40
|
* :compress_min_size defaults to 10240, which is 10k any strings larger than this are compressed before being stored
|
41
|
-
|
41
|
+
* :max_threads defaults to 28, if running in limited thread environment you can reduce this (eg Heroku)
|
42
42
|
|
43
43
|
h4. fetch(initial_key, *related_objects, &block)
|
44
44
|
|
45
|
-
This is the main caching method. Pass into this method as a block the chunck of code you want cached. The first parameter is your key for this data and is then followed by as many objects as are valid for this block of code. You can even pass in arrays and they will be expanded. The only requirement for the objects being passed in is that they respond to an 'id' method. If the last parameter is a Hash, this will be used as per cache options. These options can be used for expiry of cache.
|
45
|
+
This is the main caching method. Pass into this method as a block the chunck of code you want cached. The first parameter is your key for this data and is then followed by as many objects as are valid for this block of code. You can even pass in arrays and they will be expanded. The only requirement for the objects being passed in is that they respond to an 'id' method. If the last parameter is a Hash, this will be used as per cache options. These options can be used for expiry of cache.
|
46
46
|
|
47
47
|
bc. user_details = @coffee_table.fetch(:user_detail, @user, :expiry => 600) do
|
48
48
|
@user.get_expensive_user_details
|
@@ -85,5 +85,3 @@ bc. @coffee_table.expire_for(User)
|
|
85
85
|
this would expire all keys that reference the user objects.
|
86
86
|
|
87
87
|
The best practice for this is to be as specific as you can when creating the key. Also creating more targeted cache items may be better in some situations than having one large cache fragment.
|
88
|
-
|
89
|
-
|
data/changelog.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
0.2.2
|
2
|
+
- added max_threads option due to limited thread environment in heroku
|
1
3
|
|
2
4
|
0.1.3
|
3
5
|
- added compression for string content over 10k in size, can be turned off and limit changed
|
@@ -10,8 +12,7 @@
|
|
10
12
|
- refactored get_cache method to fetch
|
11
13
|
|
12
14
|
0.1.0
|
13
|
-
|
15
|
+
|
14
16
|
- Started a change log
|
15
17
|
- Added sourcify to md5 hash the contents of the block to remove issues around code changes not being used due to cache
|
16
18
|
- Added a key class to handle key generation and management
|
17
|
-
|
data/lib/coffee_table/version.rb
CHANGED
data/lib/coffee_table.rb
CHANGED
@@ -27,6 +27,7 @@ module CoffeeTable
|
|
27
27
|
default_ignore_code_changes_to false
|
28
28
|
default_compress_content_to true
|
29
29
|
default_compress_min_size_to 10240
|
30
|
+
default_max_threads_to 28
|
30
31
|
|
31
32
|
if @options.has_key?(:redis_url)
|
32
33
|
@redis = Redis.new({:url => @options[:redis_url]})
|
@@ -35,7 +36,7 @@ module CoffeeTable
|
|
35
36
|
end
|
36
37
|
rufus_version = Gem::Version.new(Rufus::Scheduler::VERSION)
|
37
38
|
if rufus_version >= Gem::Version.new('3.0.0')
|
38
|
-
@scheduler = Rufus::Scheduler.new
|
39
|
+
@scheduler = Rufus::Scheduler.new(:max_work_threads => @options[:max_threads])
|
39
40
|
else
|
40
41
|
@scheduler = Rufus::Scheduler.start_new
|
41
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffee_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stewart McKee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|