db_memoize 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b069a7997527c5e150d4a839c53a314dd08eda4e
4
- data.tar.gz: c8ef2bf890ba4d091e159f95d00a92ec39fa559c
3
+ metadata.gz: 542f66f353af4205b3032b105e573b3eff743f9f
4
+ data.tar.gz: 354532e3ecb878b26a2d2a292a77cb98b81019b9
5
5
  SHA512:
6
- metadata.gz: 8ac0719a0201decd8f2f14585aac6b565cbf59f8dfa0ce001c9eb639f8d651f7b21bfa64f1955a9c72e5ee207a16cedcb76d4ab093f721fd3b60a63aa22ec539
7
- data.tar.gz: 4d12e206e5510eec4527bcca2a033ce1bccdbcc04c3233859905b32aacbb2088609388f8a7ca5308288cfb22b639e5102ac0951e05f913663e966f0f840bd47c
6
+ metadata.gz: 24aa305e6dfba23e2d7a4a8afa806295d74c4e410ba65e57630bde988564272859df0a530e3e831146591a43ca8ff32c80e853cd0cb3c9c48ed8146d0536d502
7
+ data.tar.gz: 46a725d1f3b0bbd703979c718a89a44ee7cf79c2fd73b281585ec5e45b07d59f103469dd3f3c0c86909ad97b840fd6d1a3bd4f45fcde2c06fd0672561557bf76
data/README.md CHANGED
@@ -94,12 +94,6 @@ DbMemoize by default will write log output to STDOUT. You can change this by set
94
94
  DbMemoize.logger = your_logger
95
95
  ```
96
96
 
97
- To invalidate all cached keys easily you can specify a default custom key to be used internally like this:
98
-
99
- ```
100
- DbMemoize.default_custom_key = 'e.g. latest git commit hash'
101
- ```
102
-
103
97
  ### Rake Tasks
104
98
 
105
99
  To _warmup_ your cache you can pre-generate cached values via a rake task like this (only works for methods not depending on arguments)
@@ -9,7 +9,6 @@ require 'db_memoize/railtie' if defined?(Rails)
9
9
 
10
10
  module DbMemoize
11
11
  class << self
12
- attr_accessor :default_custom_key
13
12
  attr_writer :logger
14
13
 
15
14
  def logger
@@ -7,7 +7,6 @@ module DbMemoize
7
7
  t.integer :entity_id
8
8
  t.string :method_name
9
9
  t.string :arguments_hash
10
- t.string :custom_key
11
10
  t.binary :value
12
11
  t.datetime :created_at
13
12
  end
@@ -38,10 +38,6 @@ module DbMemoize
38
38
  end
39
39
  end
40
40
 
41
- def memoized_custom_key
42
- ::DbMemoize.default_custom_key
43
- end
44
-
45
41
  def memoize_values(values, *args)
46
42
  args_hash = ::Digest::MD5.hexdigest(Marshal.dump(args))
47
43
 
@@ -57,7 +53,6 @@ module DbMemoize
57
53
  entity_table_name: self.class.table_name,
58
54
  method_name: method_name.to_s,
59
55
  arguments_hash: args_hash,
60
- custom_key: memoized_custom_key.to_s,
61
56
  value: Marshal.dump(value)
62
57
  )
63
58
  end
@@ -65,8 +60,7 @@ module DbMemoize
65
60
  def find_memoized_value(method_name, args_hash)
66
61
  memoized_values.detect do |rec|
67
62
  rec.method_name == method_name.to_s &&
68
- rec.arguments_hash == args_hash &&
69
- rec.custom_key == memoized_custom_key.to_s
63
+ rec.arguments_hash == args_hash
70
64
  end
71
65
  end
72
66
 
@@ -102,7 +96,6 @@ module DbMemoize
102
96
  entity_id: id,
103
97
  method_name: name,
104
98
  arguments_hash: args_hash,
105
- custom_key: DbMemoize.default_custom_key.to_s,
106
99
  value: Marshal.dump(value)
107
100
  )
108
101
  end
@@ -2,9 +2,6 @@ module DbMemoize
2
2
  class Railtie < ::Rails::Railtie
3
3
  initializer 'Rails logger' do
4
4
  DbMemoize.logger = Rails.logger
5
-
6
- # by default invalidate cache when db schema has changed
7
- DbMemoize.default_custom_key = ActiveRecord::Migrator.current_version
8
5
  end
9
6
 
10
7
  rake_tasks do
@@ -1,3 +1,3 @@
1
1
  module DbMemoize
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_memoize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - johannes-kostas goetzinger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties