eppo-server-sdk 0.2.4 → 0.2.5

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: 98acb6907559d59d41dabba40eff3cc95404c1d2283144f73a64e05dd94b4688
4
- data.tar.gz: 86b21cbf7552a6641e34dafedb1c158812777d27821818ee3e067dd6ca1e6eff
3
+ metadata.gz: c75a17999fe2f903a2bef17b02bfefd74a3668249f5b67254c8e0b41d21f27d8
4
+ data.tar.gz: 18e358b1910d97839d8d20653506aecc7db9986a6b3dee80c50065a27059c7a7
5
5
  SHA512:
6
- metadata.gz: 38d1f7c43ded991c029cd7ac3e3c3c71116862899008d7163d216be45dd585cc7a3ea00ba04870cba2f771aeb589a75b50835c2a4d4e792de3d886879bfda7bd
7
- data.tar.gz: 2e2e690225134fb4d76d36d605f4d391aeddd3b8d0f831e5f12516ca3d9fab2f5d4267812158d266a243b4d0f53d86a0d752d14a8420e6ad8bc996ded7f13184
6
+ metadata.gz: aa31863564c84dd92d515b493b2aa7e31604e409987d51556bc85868d642a09396c6f61b297302e92d0a6dd411e3b1403efbd56bc055478c94b7ed593f370285
7
+ data.tar.gz: b9b26bdca34234ce0c1a19c1b633bc78739a6115f752e900ceaeb3a9c91f0a2acaef13998cd0c0e9d6ee9cf4f66ad23424f96fa7ca40df573550d2a1c51ae364
@@ -20,9 +20,15 @@ module EppoClient
20
20
 
21
21
  def assign_configurations(configs)
22
22
  @lock.with_write_lock do
23
+ # Create a temporary new cache and populate it.
24
+ new_cache = EppoClient::LRUCache.new(@cache.size)
23
25
  configs.each do |key, config|
24
- @cache[key] = config
26
+ new_cache[key] = config
25
27
  end
28
+
29
+ # Replace the old cache with the new one.
30
+ # Performs an atomic swap.
31
+ @cache = new_cache
26
32
  end
27
33
  end
28
34
  end
@@ -5,7 +5,7 @@ module EppoClient
5
5
  # and re-inserting a key-value pair on access moves the key to the last position. When an
6
6
  # entry is added and the cache is full, the first entry is removed.
7
7
  class LRUCache
8
- attr_reader :cache
8
+ attr_reader :cache, :size
9
9
 
10
10
  # Creates a new LRUCache that can hold +size+ entries.
11
11
  def initialize(size)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EppoClient
4
- VERSION = '0.2.4'
4
+ VERSION = '0.2.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eppo-server-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eppo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-12 00:00:00.000000000 Z
11
+ date: 2024-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby