Skip to content

Commit

Permalink
Merge pull request #44 from gocardless/faster-exists
Browse files Browse the repository at this point in the history
Make `.exists` slightly faster
  • Loading branch information
ivgiuliani authored Nov 9, 2021
2 parents 2f72ecc + 9b1286f commit e38cd26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
v0.5.0
------
- Support escaping of URI keys. Fixes #46.
- Slightly improve the performance of `.exists`

v0.4.0
------
Expand Down
2 changes: 1 addition & 1 deletion lib/bucket_store/key_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def delete!
#
# @return [bool] `true` if the given key exists, `false` if not
def exists?
list.first == "#{adapter_type}://#{bucket}/#{key}"
list(page_size: 1).first == "#{adapter_type}://#{bucket}/#{key}"
end

private
Expand Down

0 comments on commit e38cd26

Please sign in to comment.