http_cache_handler

Version, currently master branch1 version
  • master branchlatestJun 14, 2020

github.com/jwaldrip/http_cache_handler

No description declared in shard.yml.

4 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  http_cache_handler:
    github: jwaldrip/http_cache_handler
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
>= 0.34.0
License
MIT
Author
Jason Waldrip

Dependencies

Runtime Dependencies

  • cache*github: mamantoha/cache

README

http_cache_handler

A Handler to handle caching within Crystal's HTTP layer. Built with the Cache Shard

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      http_cache_handler:
        github: jwaldrip/http_cache_handler
  2. 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

  1. Fork it (https://github.com/your-github-user/http_cache_handler/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors