Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Disable TTL in SharedMemory #32

Merged
merged 1 commit into from
Jul 8, 2021
Merged

Feature: Disable TTL in SharedMemory #32

merged 1 commit into from
Jul 8, 2021

Conversation

tstone
Copy link
Collaborator

@tstone tstone commented Jul 8, 2021

Background

The README updates cover a lot of the rational about why this change was made. The short version is, this PR adds an enable_ttl setting to SharedMemory to allow TTL enforcement to be disabled in a testing context, as time doesn't quite pass the same way it does in a production environment.

Tasks

  • Code of Conduct reviewed
  • Specs written and passing
  • Backwards-incompatible changes called out in this PR
  • Increment the version file (./lib/atomic_cache/version.rb) when applicable

@tstone tstone requested a review from lebeerman July 8, 2021 21:18
Comment on lines +9 to +22

context 'enforce_ttl disabled' do
before(:each) do
AtomicCache::Storage::SharedMemory.enforce_ttl = false
end

it 'allows instantly `add`ing keys' do
subject.add("foo", 1, ttl: 100000)
subject.add("foo", 2, ttl: 1)

expect(subject.store).to have_key(:foo)
expect(Marshal.load(subject.store[:foo][:value])).to eq(2)
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome example test.

@tstone tstone merged commit 3d6375f into main Jul 8, 2021
@tstone tstone deleted the feature/disable-ttl branch July 8, 2021 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants