infopark_cloud_connector 6.8.0.beta.200.884.4bd86e6 → 6.8.0.beta.200.889.d503e42

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,6 +21,10 @@ class Cache
21
21
  @cache[key] = value
22
22
  end
23
23
 
24
+ def fetch(key, &block)
25
+ read(key) || block.call.tap { |value| write(key, value) }
26
+ end
27
+
24
28
  private
25
29
 
26
30
  def cache_key_for_fallback_backend(key)
@@ -11,6 +11,7 @@ class CacheMiddleware
11
11
  @app.call(env)
12
12
  ensure
13
13
  Revision.end_caching
14
+ DictStorage.clear_first_level_cache
14
15
  end
15
16
  end
16
17
 
@@ -6,13 +6,18 @@ module RailsConnector
6
6
 
7
7
  def configure(config)
8
8
  @config = config.present? ? config.symbolize_keys : {}
9
+ @storage = nil
9
10
  end
10
11
 
11
- def get(spec)
12
- storage.get(spec)
12
+ def get(key)
13
+ cache.fetch(key) { storage.get(key) }
13
14
  end
14
15
 
15
- private
16
+ # clears the in-memory cache.
17
+ # does not affect a potential second level cache present in the underlying storage.
18
+ def clear_first_level_cache
19
+ @cache = nil
20
+ end
16
21
 
17
22
  attr_reader :config
18
23
 
@@ -28,6 +33,12 @@ module RailsConnector
28
33
  end
29
34
  end
30
35
 
36
+ private
37
+
38
+ def cache
39
+ @cache ||= Cache.new
40
+ end
41
+
31
42
  def s3_storage(config)
32
43
  if config && !config.key?("s3_endpoint") && !config.key?(:s3_endpoint)
33
44
  config = config.merge(:s3_endpoint => "s3-eu-west-1.amazonaws.com")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_cloud_connector
3
3
  version: !ruby/object:Gem::Version
4
- hash: -610997703
4
+ hash: -629374736
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 6
@@ -9,13 +9,12 @@ version: !ruby/object:Gem::Version
9
9
  - 0
10
10
  - beta
11
11
  - 200
12
- - 884
13
- - 4
14
- - bd
15
- - 86
12
+ - 889
13
+ - d
14
+ - 503
16
15
  - e
17
- - 6
18
- version: 6.8.0.beta.200.884.4bd86e6
16
+ - 42
17
+ version: 6.8.0.beta.200.889.d503e42
19
18
  platform: ruby
20
19
  authors:
21
20
  - Infopark AG
@@ -23,7 +22,7 @@ autorequire:
23
22
  bindir: bin
24
23
  cert_chain: []
25
24
 
26
- date: 2012-08-15 00:00:00 +02:00
25
+ date: 2012-08-17 00:00:00 +02:00
27
26
  default_executable:
28
27
  dependencies:
29
28
  - !ruby/object:Gem::Dependency
@@ -63,20 +62,19 @@ dependencies:
63
62
  requirements:
64
63
  - - "="
65
64
  - !ruby/object:Gem::Version
66
- hash: -610997703
65
+ hash: -629374736
67
66
  segments:
68
67
  - 6
69
68
  - 8
70
69
  - 0
71
70
  - beta
72
71
  - 200
73
- - 884
74
- - 4
75
- - bd
76
- - 86
72
+ - 889
73
+ - d
74
+ - 503
77
75
  - e
78
- - 6
79
- version: 6.8.0.beta.200.884.4bd86e6
76
+ - 42
77
+ version: 6.8.0.beta.200.889.d503e42
80
78
  version_requirements: *id003
81
79
  name: kvom
82
80
  prerelease: false