zache 0.5.3 → 0.6.0

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
  SHA256:
3
- metadata.gz: 60df3e71e2b231946894808553577fa3877e865f1556858d195e0d49957b75d0
4
- data.tar.gz: 2d64c893d7bf7dd43d5788b9a3ad155df595dc8ad22b48f536ed4484b037dd4f
3
+ metadata.gz: e1946835650fe9364a00701710789c08de9e93b03b1885a9ac924203940c2b27
4
+ data.tar.gz: 99cb4f482d86a3c1288ef8705c05638a24fd7e580d682e60fa610e61a0e92f02
5
5
  SHA512:
6
- metadata.gz: 27bb7605e2618a94c0bcc2d6978a19055bbced16b7f398a1ad232009d091259c7846efde96975bb0929940f9fc52a47345a62007b3b6fccaed7870eaf04cc267
7
- data.tar.gz: 7101a0956069c62e85dfcc7796033e0133303a0f3b8ee87a46b90316991db1d2fd41ff1375c3b7fd1985412e7c301d9b876576d2f41b5876bc8550c3ad673441
6
+ metadata.gz: 93ea85258dd3439d79ebfff81676e8a60dffcfba29539d5fa1a180682001e92cb0cc4841274f985cbce164bc10b4767654e64a4edc4db76c43b68bf5b1017a62
7
+ data.tar.gz: eb1084cc733ca67a49783526621c81289e0492e3de9d1483ecaa557763588aa2d29414ab570b23f25865e41b62f80b039ee414d75b3d8d76608f0f097cb5387c
data/.gitignore CHANGED
@@ -3,3 +3,4 @@ Gemfile.lock
3
3
  .bundle/
4
4
  .DS_Store
5
5
  rdoc/
6
+ .idea/
data/lib/zache.rb CHANGED
@@ -37,6 +37,31 @@
37
37
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
38
38
  # License:: MIT
39
39
  class Zache
40
+ # Fake implementation that doesn't cache anything, but behaves like it
41
+ # does. It implements all methods of the original class, but doesn't do
42
+ # any caching. This is very useful for testing.
43
+ class Fake
44
+ def get(*)
45
+ yield
46
+ end
47
+
48
+ def exists?(*)
49
+ true
50
+ end
51
+
52
+ def locked?
53
+ false
54
+ end
55
+
56
+ def put(*); end
57
+
58
+ def remove(_key); end
59
+
60
+ def remove_all; end
61
+
62
+ def clean; end
63
+ end
64
+
40
65
  # Makes a new object of the cache.
41
66
  # "sync" is whether the hash is thread-safe (`true`)
42
67
  # or not (`false`); it is recommended to leave this parameter untouched,
data/test/test_zache.rb CHANGED
@@ -234,4 +234,9 @@ class ZacheTest < Minitest::Test
234
234
  end
235
235
  assert_equal(threads, set.size)
236
236
  end
237
+
238
+ def test_fake_class_works
239
+ cache = Zache::Fake.new
240
+ assert_equal(1, cache.get(:x) { 1 })
241
+ end
237
242
  end
data/zache.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.rubygems_version = '2.5'
32
32
  s.required_ruby_version = '>=2.5'
33
33
  s.name = 'zache'
34
- s.version = '0.5.3'
34
+ s.version = '0.6.0'
35
35
  s.license = 'MIT'
36
36
  s.summary = 'In-memory Cache'
37
37
  s.description = 'Zero-footprint in-memory thread-safe cache'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-19 00:00:00.000000000 Z
11
+ date: 2018-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby