Skip to content

Commit

Permalink
Update readme to mention the reset! method
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwestendorf committed Sep 19, 2024
1 parent 3a3ab51 commit b23c304
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,25 @@ end
TTLMemoizeable.disable!
```

3. Conditionally TTL memoize the method based on test environment or some other condition.
3. Reset ttl memoization values before/after your test runs.

```ruby
# RSpec
RSpec.configure do |config|
config.around { TTLMemoizeable.reset!; _1.run; TTLMemoizeable.reset! }
end

# minitest
def setup
TTLMemoizeable.reset!
end

def teardown
TTLMemoizeable.reset!
end
```

4. Conditionally TTL memoize the method based on test environment or some other condition.
```ruby
def config
JSON.parse($redis.get("some_big_json_string"))
Expand Down

0 comments on commit b23c304

Please sign in to comment.