expiring_hash
expiring_hash
Inspired by expiringdict
Installation
-
Add the dependency to your
shard.yml
:dependencies: expiring_hash: github: lun-4/expiring_hash
-
Run
shards install
Usage
require "expiring_hash"
alias MyCoolCache = ExpiringHash(String, String)
# hash entries can be kept inside the expiring hash for more than 5 minutes,
# trying to access those entires will mean their deletion, though.
#
# if the hash has more than 10 times, all entries that should be deleted will be.
# the insert operation will fail if no entries are invalidated
#
# set max_items to `nil` to remove this behavior
my_cool_cache = MyCoolCache.new(10, 5.minutes)
# use as any hash
my_cool_cache["a"] = "b"
Contributing
- Fork it (https://github.com/lun-4/expiring_hash/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- lun-4 - creator and maintainer
Repository
expiring_hash
Owner
Statistic
- 3
- 0
- 0
- 2
- 0
- over 3 years ago
- January 6, 2021
License
MIT License
Links
Synced at
Fri, 22 Nov 2024 08:11:33 GMT
Languages