typed_cache 0.4.0.pre.1 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ec41a8981323affe19dcf95567cd004f58c744e6bada1e4b629678eda393f7d
4
- data.tar.gz: 35cc676a0564191003dec33b91c53e98fea1e1f90bdc89269fbbfa35c395b2eb
3
+ metadata.gz: f4ce9735b042027d3a74d3d5b624c916dade1673855d906503c843e214ab08f7
4
+ data.tar.gz: 1e448a580e62f8889edd6520066d3ef212bf3ad8892e58ce79ba1d3eaec94fbf
5
5
  SHA512:
6
- metadata.gz: 51a2c6dd90dcf5757d8058021cae3eb1d3002c0441673f008ed1c0a1302b8b3b32ad21981cf21c909ee0bf2f6a67f59827397bb0169d0f33e9fd536d9a468cac
7
- data.tar.gz: 5f9a98912d940cbc4fb357f65d273ad030b7f97200a374b31b7b246c66ac85a733cd4b9332b545ea03fe7f25053271dcc19a4919e9312c2e0f85ea348a7eefce
6
+ metadata.gz: 7173225ff902a77ac9083483a005238ac7b54301943a75c4179e52ccaaaaff12923f17a0d427f6f7a07da56d183e588c4fe8922af64b4a0c7077e1042f786805
7
+ data.tar.gz: 5b9e1fefd5b4e82e5cb24f126336a69d92c91e2b2d0312b19e1ad82e3af5967721224d47bd1960dfcf2637dc50c92da1d290fa9783a3b6a2f320d9ee7b9e4acd
checksums.yaml.gz.sig CHANGED
Binary file
@@ -18,7 +18,7 @@ module TypedCache
18
18
  # def read_multi: (Array[cache_key], **top) -> Hash[cache_key, V]
19
19
  # def write: (cache_key, V, **top) -> V
20
20
  # def write_multi: (Hash[cache_key, V], **top) -> Hash[cache_key, V]
21
- # def delete: (cache_key) -> V?
21
+ # def delete: (cache_key, **top) -> V?
22
22
  # def key?: (cache_key) -> bool
23
23
  # def clear: () -> void
24
24
  # def fetch: (cache_key, **top) { () -> V? } -> V?
@@ -52,19 +52,19 @@ module TypedCache
52
52
  end
53
53
 
54
54
  # @rbs override
55
- # @rbs (cache_key) -> V?
55
+ # @rbs (cache_key, **top) -> V?
56
56
  def delete(key, **opts)
57
57
  raise NotImplementedError, "#{self.class} must implement #delete"
58
58
  end
59
59
 
60
60
  # @rbs override
61
61
  # @rbs (cache_key) -> bool
62
- def key?(key, **opts)
62
+ def key?(key)
63
63
  raise NotImplementedError, "#{self.class} must implement #key?"
64
64
  end
65
65
 
66
66
  # @rbs override
67
- # @rbs () -> void
67
+ # @rbs (**top) -> void
68
68
  def clear(**opts)
69
69
  raise NotImplementedError, "#{self.class} must implement #clear"
70
70
  end
@@ -80,14 +80,6 @@ module TypedCache
80
80
  def fetch_multi(keys, **opts, &block)
81
81
  keys.to_h { |key| [key, fetch(key, **opts, &block)] }
82
82
  end
83
-
84
- # @rbs override
85
- # @rbs () -> String
86
- def to_s = self.class.name
87
-
88
- # @rbs override
89
- # @rbs () -> String
90
- def inspect = self.class.inspect
91
83
  end
92
84
 
93
85
  # @rbs! type backend[V] = Backend::_Backend[V]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TypedCache
4
- VERSION = '0.4.0-1'
4
+ VERSION = '0.4.0'
5
5
  end
@@ -4,25 +4,25 @@ module TypedCache
4
4
  module Backend
5
5
  extend T::Generic
6
6
 
7
- interface!
7
+ abstract!
8
8
 
9
9
  BackendType = type_member
10
10
 
11
- KeyValue = T.type_alias { T.any(CacheKey, String) }
11
+ KeyValue = T.type_alias { T.any(::TypedCache::CacheKey, String) }
12
12
 
13
- sig { abstract.params(key: KeyValue, opts: T::Hash[Symbol, T.untyped]).returns(Either[Error, Snapshot[Maybe[BackendType]]]) }
13
+ sig { abstract.params(key: KeyValue, opts: T::Hash[Symbol, T.untyped]).returns(T.nilable(BackendType)) }
14
14
  def read(key, **opts); end
15
15
 
16
- sig { abstract.params(key: KeyValue, value: BackendType, opts: T::Hash[Symbol, T.untyped]).returns(Either[Error, Snapshot[BackendType]]) }
16
+ sig { abstract.params(key: KeyValue, value: BackendType, opts: T::Hash[Symbol, T.untyped]).returns(BackendType) }
17
17
  def write(key, value, **opts); end
18
18
 
19
- sig { abstract.params(key: KeyValue).returns(Either[Error, Snapshot[Maybe[BackendType]]]) }
20
- def delete(key); end
19
+ sig { abstract.params(key: KeyValue, opts: T::Hash[Symbol, T.untyped]).returns(T.nilable(BackendType)) }
20
+ def delete(key, **opts); end
21
21
 
22
- sig { abstract.params(keys: T::Array[KeyValue], opts: T::Hash[Symbol, T.untyped]).returns(Either[Error, T::Hash[KeyValue, Snapshot[BackendType]]]) }
22
+ sig { abstract.params(keys: T::Array[KeyValue], opts: T::Hash[Symbol, T.untyped]).returns(T::Hash[KeyValue, BackendType]) }
23
23
  def read_multi(keys, **opts); end
24
24
 
25
- sig { abstract.params(values: T::Hash[KeyValue, BackendType], opts: T::Hash[Symbol, T.untyped]).returns(Either[Error, T::Hash[KeyValue, Snapshot[BackendType]]]) }
25
+ sig { abstract.params(values: T::Hash[KeyValue, BackendType], opts: T::Hash[Symbol, T.untyped]).returns(T::Hash[KeyValue, BackendType]) }
26
26
  def write_multi(values, **opts); end
27
27
 
28
28
  sig { abstract.void }
@@ -31,21 +31,18 @@ module TypedCache
31
31
  sig { abstract.params(key: KeyValue).returns(T::Boolean) }
32
32
  def key?(key); end
33
33
 
34
- sig { abstract.returns(T.nilable(Instrumenter)) }
35
- def instrumenter; end
36
-
37
34
  sig do
38
35
  abstract
39
36
  .type_parameters(:K)
40
- .params(key: T.all(KeyValue, T.type_parameter(:K)), block: T.proc.params(key: T.all(KeyValue, T.type_parameter(:K))).returns(T.nilable(BackendType))).returns(Either[Error, Snapshot[Maybe[BackendType]]])
37
+ .params(key: T.all(KeyValue, T.type_parameter(:K)), opts: T::Hash[Symbol, T.untyped], block: T.proc.params(key: T.all(KeyValue, T.type_parameter(:K))).returns(T.nilable(BackendType))).returns(T.nilable(BackendType))
41
38
  end
42
- def fetch(key, &block); end
39
+ def fetch(key, **opts, &block); end
43
40
 
44
41
  sig do
45
42
  abstract
46
43
  .type_parameters(:K)
47
- .params(keys: T::Array[T.all(KeyValue, T.type_parameter(:K))], block: T.proc.params(key: T.all(KeyValue, T.type_parameter(:K))).returns(T.nilable(BackendType))).returns(Either[Error, T::Hash[KeyValue, Snapshot[BackendType]]])
44
+ .params(keys: T::Array[T.all(KeyValue, T.type_parameter(:K))], opts: T::Hash[Symbol, T.untyped], block: T.proc.params(key: T.all(KeyValue, T.type_parameter(:K))).returns(T.nilable(BackendType))).returns(T::Hash[T.all(KeyValue, T.type_parameter(:K)), BackendType])
48
45
  end
49
- def fetch_multi(keys, &block); end
46
+ def fetch_multi(keys, **opts, &block); end
50
47
  end
51
48
  end
@@ -7,10 +7,10 @@ module TypedCache
7
7
 
8
8
  InstrumenterSource = T.type_alias { T.any(Symbol, ::TypedCache::Instrumenter) }
9
9
 
10
- interface!
10
+ abstract!
11
11
  sealed!
12
12
 
13
- sig { abstract.params(name: Symbol, args: T.untyped, options: T::Hash[Symbol, T.anything]).returns(T.all(CacheDefinition, CacheBuilder)) }
13
+ sig { abstract.params(name: Symbol, args: T.untyped, options: T::Hash[Symbol, T.anything]).returns(T.all(::TypedCache::CacheDefinition, ::TypedCache::CacheBuilding)) }
14
14
  def with_backend(name, *args, **options); end
15
15
 
16
16
  sig { abstract.params(name: Symbol, options: T::Hash[Symbol, T.anything]).returns(T.self_type) }
@@ -20,11 +20,11 @@ module TypedCache
20
20
  def with_instrumentation(source = T.unsafe(nil)); end
21
21
  end
22
22
 
23
- module CacheBuilder
23
+ module CacheBuilding
24
24
  extend T::Sig
25
25
  extend T::Helpers
26
26
 
27
- interface!
27
+ abstract!
28
28
  sealed!
29
29
 
30
30
  sig { abstract.params(namespace: ::TypedCache::Namespace).returns(::TypedCache::Either[::TypedCache::Error, ::TypedCache::Store[T.untyped]]) }
@@ -39,4 +39,9 @@ module TypedCache
39
39
  sig { abstract.returns(::TypedCache::Backend[T.untyped]) }
40
40
  def build_backend!; end
41
41
  end
42
+
43
+ class CacheBuilder
44
+ include ::TypedCache::CacheBuilding
45
+ include ::TypedCache::CacheDefinition
46
+ end
42
47
  end
@@ -17,37 +17,34 @@ module TypedCache
17
17
  sig { abstract.returns(::TypedCache::Backend[BackendType]) }
18
18
  def backend; end
19
19
 
20
- sig { override.params(key: KeyValue, opts: T::Hash[Symbol, T.untyped]).returns(::TypedCache::Either[Error, ::TypedCache::Snapshot[Maybe[BackendType]]]) }
20
+ sig { override.overridable.params(key: KeyValue, opts: T::Hash[Symbol, T.untyped]).returns(T.nilable(BackendType)) }
21
21
  def read(key, **opts); end
22
22
 
23
- sig { override.params(key: KeyValue, value: BackendType, opts: T::Hash[Symbol, T.untyped]).returns(::TypedCache::Either[Error, ::TypedCache::Snapshot[BackendType]]) }
23
+ sig { override.overridable.params(key: KeyValue, value: BackendType, opts: T::Hash[Symbol, T.untyped]).returns(BackendType) }
24
24
  def write(key, value, **opts); end
25
25
 
26
- sig { override.params(key: KeyValue).returns(::TypedCache::Either[Error, ::TypedCache::Snapshot[Maybe[BackendType]]]) }
27
- def delete(key); end
26
+ sig { override.overridable.params(key: KeyValue, opts: T::Hash[Symbol, T.untyped]).returns(T.nilable(BackendType)) }
27
+ def delete(key, **opts); end
28
28
 
29
- sig { override.params(key: KeyValue).returns(T::Boolean) }
29
+ sig { override.overridable.params(key: KeyValue).returns(T::Boolean) }
30
30
  def key?(key); end
31
31
 
32
- sig { override.params(key: KeyValue, opts: T::Hash[Symbol, T.untyped], block: T.proc.returns(T.nilable(BackendType))).returns(::TypedCache::Either[Error, ::TypedCache::Snapshot[Maybe[BackendType]]]) }
32
+ sig { override.overridable.params(key: KeyValue, opts: T::Hash[Symbol, T.untyped], block: T.proc.returns(T.nilable(BackendType))).returns(T.nilable(BackendType)) }
33
33
  def fetch(key, **opts, &block); end
34
34
 
35
- sig { override.params(keys: T::Array[KeyValue], opts: T::Hash[Symbol, T.untyped]).returns(::TypedCache::Either[Error, T::Hash[KeyValue, Snapshot[BackendType]]]) }
35
+ sig { override.overridable.params(keys: T::Array[KeyValue], opts: T::Hash[Symbol, T.untyped]).returns(T::Hash[KeyValue, BackendType]) }
36
36
  def read_multi(keys, **opts); end
37
37
 
38
- sig { override.params(keys: T::Array[KeyValue], opts: T::Hash[Symbol, T.untyped], block: T.proc.params(key: KeyValue).returns(T.nilable(BackendType))).returns(::TypedCache::Either[Error, T::Hash[KeyValue, Snapshot[BackendType]]]) }
38
+ sig { override.overridable.params(keys: T::Array[KeyValue], opts: T::Hash[Symbol, T.untyped], block: T.proc.params(key: KeyValue).returns(T.nilable(BackendType))).returns(T::Hash[KeyValue, BackendType]) }
39
39
  def fetch_multi(keys, **opts, &block); end
40
40
 
41
- sig { override.params(values: T::Hash[KeyValue, BackendType], opts: T::Hash[Symbol, T.untyped]).returns(::TypedCache::Either[Error, T::Hash[KeyValue, Snapshot[BackendType]]]) }
41
+ sig { override.overridable.params(values: T::Hash[KeyValue, BackendType], opts: T::Hash[Symbol, T.untyped]).returns(T::Hash[KeyValue, BackendType]) }
42
42
  def write_multi(values, **opts); end
43
43
 
44
- sig { override.void }
44
+ sig { override.overridable.void }
45
45
  def clear; end
46
46
 
47
47
  sig { overridable.params(other: T.self_type).void }
48
48
  def initialize_copy(other); end
49
-
50
- sig { override.returns(T.nilable(::TypedCache::Instrumenter)) }
51
- def instrumenter; end
52
49
  end
53
50
  end
@@ -21,7 +21,7 @@ module TypedCache
21
21
 
22
22
  def write_multi: (Hash[cache_key, V], **top) -> Hash[cache_key, V]
23
23
 
24
- def delete: (cache_key) -> V?
24
+ def delete: (cache_key, **top) -> V?
25
25
 
26
26
  def key?: (cache_key) -> bool
27
27
 
@@ -51,7 +51,7 @@ module TypedCache
51
51
  def write_multi: ...
52
52
 
53
53
  # @rbs override
54
- # @rbs (cache_key) -> V?
54
+ # @rbs (cache_key, **top) -> V?
55
55
  def delete: ...
56
56
 
57
57
  # @rbs override
@@ -59,7 +59,7 @@ module TypedCache
59
59
  def key?: ...
60
60
 
61
61
  # @rbs override
62
- # @rbs () -> void
62
+ # @rbs (**top) -> void
63
63
  def clear: ...
64
64
 
65
65
  # @rbs override
@@ -69,14 +69,6 @@ module TypedCache
69
69
  # @rbs override
70
70
  # @rbs (Array[cache_key], **top) { (cache_key) -> V? } -> Hash[cache_key, V]
71
71
  def fetch_multi: ...
72
-
73
- # @rbs override
74
- # @rbs () -> String
75
- def to_s: ...
76
-
77
- # @rbs override
78
- # @rbs () -> String
79
- def inspect: ...
80
72
  end
81
73
 
82
74
  type backend[V] = Backend::_Backend[V]
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typed_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.pre.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Autumn Winter
@@ -220,7 +220,7 @@ licenses:
220
220
  - Apache-2.0
221
221
  metadata:
222
222
  issue_tracker_uri: https://github.com/glossawy/typed_cache/issues
223
- changelog_uri: https://github.com/glossawy/typed_cache/blob/main/VERSIONS.adoc#040-1
223
+ changelog_uri: https://github.com/glossawy/typed_cache/blob/main/VERSIONS.adoc#040
224
224
  license_uri: https://github.com/glossawy/typed_cache/blob/main/LICENSE
225
225
  label: caching
226
226
  labels: typed_cache,ruby,caching,type-safety,rails,rbs
metadata.gz.sig CHANGED
Binary file