https://github.com/zverok/faraday_naive_cache
Naive greedy cache for Faraday, (almost) no dependencies
https://github.com/zverok/faraday_naive_cache
Last synced: 2 days ago
JSON representation
Naive greedy cache for Faraday, (almost) no dependencies
- Host: GitHub
- URL: https://github.com/zverok/faraday_naive_cache
- Owner: zverok
- Created: 2016-01-18T21:03:03.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-18T21:03:40.000Z (over 10 years ago)
- Last Synced: 2025-03-21T15:47:24.938Z (over 1 year ago)
- Language: Ruby
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Naive cache middleware for Faraday
Very naive. Such useful. Wow.
Usage:
```ruby
require 'faraday'
require 'faraday/naive_cache'
connection = Faraday.new 'http://example.com/api' do |conn|
conn.use Faraday::NaiveCache
conn.adapter Faraday.default_adapter
end
conn.get 'some_endpoint' # real query
# and then...
conn.get 'some_endpoint' # get file from disc, stored in tmp/cache
```
## TODO
* Path settings;
* Cache invalidation strategies;
* Many other useful enchancements.