json_api_resource_connections 1.0.2 → 1.0.3
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 +4 -4
- data/README.md +8 -0
- data/lib/json_api_resource_connections/version.rb +1 -1
- data/lib/json_api_resource_connections.rb +22 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71a664de7de58f8bfc1cfc8446110d13bcd4d392
|
4
|
+
data.tar.gz: 65d96095eb48e63d09b48cc20407fdd15caeb489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48232fba63b0c98e9e6f98e98584c5d50d3ad57b6c28596c469e3b9ac939fe0d8a5d9352ac635fec423e8ab9316b8dda98460aee30a3c993f2b65b97fde9a298
|
7
|
+
data.tar.gz: a3be6f732b7f57fb205e11e6a83da45482b635e5bd1ec2449d214d471fbe069bbef46be6dee841d04f706e0b64ff01ee52a429d506def2692576b64aef0113b1
|
data/README.md
CHANGED
@@ -38,6 +38,14 @@ Will force the resource to try to fetch the data requested from the cache first,
|
|
38
38
|
|
39
39
|
Requires caching to be enabled as described in [setup](#setup).
|
40
40
|
|
41
|
+
#### cacheless_find( id )
|
42
|
+
|
43
|
+
If you are using `try_cache_first` and need to bypass it for `find`, this is the way to do it.
|
44
|
+
|
45
|
+
#### cacheless_where( opts = {} )
|
46
|
+
|
47
|
+
If you are using `try_cache_first` and need to bypass it for `where`, this is the way to do it.
|
48
|
+
|
41
49
|
### Components
|
42
50
|
|
43
51
|
#### CacheProcessor
|
@@ -53,6 +53,28 @@ module JsonApiResourceConnections
|
|
53
53
|
# now that we know where to connect to, let's do it
|
54
54
|
add_connection JsonApiResource::Connections::CachedCircuitbreakerServerConnection, client: self.client_class
|
55
55
|
end
|
56
|
+
|
57
|
+
def cacheless_find( id )
|
58
|
+
direct_execute :find, id
|
59
|
+
end
|
60
|
+
|
61
|
+
def cacheless_where( opts = {} )
|
62
|
+
direct_execute :where, opts
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
# skips looking in cache first and goes to the server directly
|
68
|
+
def direct_execute( action, *args )
|
69
|
+
results = cacheless_connection.execute(action, *args)
|
70
|
+
JsonApiResource::Handlers::FindHandler.new(results).result
|
71
|
+
end
|
72
|
+
|
73
|
+
def cacheless_connection
|
74
|
+
@cacheless_connection ||=_connections.find do |c|
|
75
|
+
c.is_a? JsonApiResource::Connections::CachedCircuitbreakerServerConnection
|
76
|
+
end
|
77
|
+
end
|
56
78
|
end
|
57
79
|
end
|
58
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_api_resource_connections
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -130,3 +130,4 @@ signing_key:
|
|
130
130
|
specification_version: 4
|
131
131
|
summary: circuit breaker and cache fallback connections for json api resource v2
|
132
132
|
test_files: []
|
133
|
+
has_rdoc:
|