linked_rails 0.0.4.pre.g92825d924 → 0.0.4.pre.gd8464437f

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: 2dfbd0d96709d5036bcfcb422c88bf39e1c8c006ae4a4e5d6c8dfabc7d45cbb7
4
- data.tar.gz: b5629f658ccf27bcd7ca9605d001668f55df2d5b311ce170a20c68a7cc895057
3
+ metadata.gz: d0469495fc05ef96aed75db4a9a3f1cf7e1ed7dfed36760c6960d370369515c1
4
+ data.tar.gz: f3ed8428a3ca3421c43cb6e702a3353eedfb5bcc09db67a85670ebf37cbd8aaa
5
5
  SHA512:
6
- metadata.gz: bd523b32c77f3836257b1821b0a70fe4fcd9e6ab75bf39366501e75104aed3fe92ab9a690468051aacdace53ae5b79182642d3a55147da0d409f107fa47e1e7f
7
- data.tar.gz: 220bac95f7fc0f3ca454e4dc7e6ca9953afc60e0e8230c497c22a8751cdc78a1c654760fa57908f2b4c716b382e308a371f104b8b48db027d081f4e1db3e8f3b
6
+ metadata.gz: 52a4634ca24036a3281671d4829ba527ccc5790c6e4c6d87bfc2b3208f88c3d00ca8db0370b4aeffc8d77da8629058999a6677923a002c5f5680a30d4cd89f1e
7
+ data.tar.gz: 4d48f8396c5a5209fbf9373362cca8efc693493ec650034359119d9a39809a9ba2511af80aa8820c3439aaf5156f143608e4361b3def860cc33119db180cb93c
@@ -9,9 +9,7 @@ module LinkedRails
9
9
  Storage.hset(
10
10
  :persistent,
11
11
  :manifest,
12
- {
13
- LinkedRails.iri.to_s => web_manifest.to_json
14
- }
12
+ LinkedRails.iri.to_s => web_manifest.to_json
15
13
  )
16
14
  end
17
15
 
@@ -167,6 +165,12 @@ module LinkedRails
167
165
  end
168
166
 
169
167
  def move(from, to)
168
+ Storage.hset(
169
+ :persistent,
170
+ :redirect_prefix,
171
+ from => to
172
+ )
173
+
170
174
  data = Storage.hget(:persistent, :manifest, from)
171
175
 
172
176
  Storage.hset(:persistent, :manifest, to, data) if data
@@ -8,7 +8,7 @@ module LinkedRails
8
8
  resource: iri,
9
9
  resourceType: resource_type
10
10
  }
11
- id = Storage.xadd(:stream, entry)
11
+ id = Storage.xadd(:stream, LinkedRails.cache_stream, entry)
12
12
 
13
13
  raise('No message id returned, implies failure') if id.blank?
14
14
  end
@@ -17,8 +17,6 @@ module LinkedRails
17
17
  true
18
18
  end
19
19
 
20
- private
21
-
22
20
  def publish_create
23
21
  publish_message('io.ontola.transactions.Created')
24
22
  end
@@ -31,14 +29,14 @@ module LinkedRails
31
29
  publish_message('io.ontola.transactions.Deleted')
32
30
  end
33
31
 
32
+ private
33
+
34
34
  def publish_message(type)
35
35
  LinkedRails::InvalidationStreamWorker.perform_now(type, iri.to_s, self.class.iri.to_s)
36
36
  rescue StandardError
37
37
  LinkedRails::InvalidationStreamWorker.perform_later(type, iri.to_s, self.class.iri.to_s)
38
38
  end
39
39
 
40
- private
41
-
42
40
  def should_publish_changes
43
41
  cacheable? && !Rails.env.test?
44
42
  end
@@ -4,26 +4,27 @@ require 'redis'
4
4
 
5
5
  module LinkedRails
6
6
  class Storage
7
- CLIENT = {
8
- cache: Redis.new(db: LinkedRails.cache_redis_database),
9
- persistent: Redis.new(db: LinkedRails.persistent_redis_database),
10
- stream: Redis.new(db: LinkedRails.stream_redis_database)
7
+ REDIS_DB = {
8
+ cache: LinkedRails.cache_redis_database,
9
+ persistent: LinkedRails.persistent_redis_database,
10
+ stream: LinkedRails.stream_redis_database
11
11
  }.freeze
12
12
  KEYS = {
13
13
  manifest: 'cache:Manifest',
14
- redirect: 'cache:Redirect'
14
+ redirect_exact: 'cache:Redirect:Exact',
15
+ redirect_prefix: 'cache:Redirect:Prefix'
15
16
  }.freeze
16
17
 
17
18
  class << self
18
19
  %i[xadd].each do |method|
19
20
  define_method(method) do |db, *args|
20
- CLIENT.fetch(db).send(method, *args)
21
+ Redis.new(db: REDIS_DB.fetch(db)).send(method, *args)
21
22
  end
22
23
  end
23
24
 
24
25
  %i[hset hdel hget].each do |method|
25
26
  define_method(method) do |db, key, *args|
26
- CLIENT.fetch(db).send(method, KEYS.fetch(key), *args)
27
+ Redis.new(db: REDIS_DB.fetch(db)).send(method, KEYS.fetch(key), *args)
27
28
  end
28
29
  end
29
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linked_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.pre.g92825d924
4
+ version: 0.0.4.pre.gd8464437f
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Dingemans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-09 00:00:00.000000000 Z
11
+ date: 2022-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_response