http_cache_handler
http_cache_handler
A Handler to handle caching within Crystal's HTTP layer. Built with the Cache Shard
Installation
-
Add the dependency to your
shard.yml
:dependencies: http_cache_handler: github: jwaldrip/http_cache_handler
-
Run
shards install
Usage
You can use HTTPCacheHandler with any framework that accepts a Crystal HTTP::Handler
. See the guides for this on popular frameworks such as Kemal, Amber, Lucky, Orion, and Grip. See the options below for how to configure with the various strategies.
require "http_cache_handler"
# In Memory
HTTPCacheHandler.new expires_in: 30.minutes
# With a file
HTTPCacheHandler.new expires_in: 30.minutes, path: "tmp/cache"
# With Redis
redis_client = Redis::Client.new
HTTPCacheHandler.new expires_in: 30.minutes, redis: redis_client
# With MemCached
memcached_client = Memcached::Client.new
HTTPCacheHandler.new expires_in: 30.minutes, memcached: memcached_client
# Null Store (for devlopment)
HTTPCacheHandler.new expires_in: 30.minutes, null: true
Contributing
- Fork it (https://github.com/your-github-user/http_cache_handler/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
- jwaldrip - creator and maintainer
Repository
http_cache_handler
Owner
Statistic
- 3
- 0
- 0
- 1
- 0
- over 4 years ago
- June 14, 2020
License
MIT License
Links
Synced at
Thu, 07 Nov 2024 13:24:21 GMT
Languages