Faraday Http Cache

程序名称:Faraday Http Cache

授权协议: Apache

操作系统: 跨平台

开发语言: Ruby

Faraday Http Cache 介绍

Faraday Http Cache 是一个 Faraday 的扩展,实现了
HTTP 的缓存。通过检查过期时间来验证已存储的响应信息。

使用方法:

client = Faraday.new do |builder|
  builder.use :http_cache, store: Rails.cache
  # or
  builder.use Faraday::HttpCache, store: Rails.cache

  builder.adapter Faraday.default_adapter
end

使用 Memcached:

# Connect the middleware to a Memcache instance.
store = ActiveSupport::Cache.lookup_store(:mem_cache_store, ['localhost:11211'])

client = Faraday.new do |builder|
  builder.use :http_cache, store: store
  builder.adapter Faraday.default_adapter
end

# Or use the Rails.cache instance inside your Rails app.
client = Faraday.new do |builder|
  builder.use :http_cache, store: Rails.cache
  builder.adapter Faraday.default_adapter
end

日志:

client = Faraday.new do |builder|
  builder.use :http_cache, store: Rails.cache, logger: Rails.logger
  builder.adapter Faraday.default_adapter
end

client.get('http://site/api/users')
# logs "HTTP Cache: [GET users] miss, store"

Faraday Http Cache 官网

https://github.com/plataformatec/faraday-http-cache

相关编程语言

BlazeDS 是一个基于服务器的Java 远程控制(remoting...
OVal 是一个可扩展的Java对象数据验证框架,验证的规...
Volta 是一套开发工具,专为开发分布式、实时系统应...
OpenDDS 是一个开源的 C++ 实现的 对象管理组织 OMG...
JADE (Java Agent DEvelopment Framework) 是一个完...
FastMM ,在D2006和2007中已代替了原来的内存管理器。