lib/pupa/processor/client.rb in pupa-0.1.0 vs lib/pupa/processor/client.rb in pupa-0.1.1
- old
+ new
@@ -27,13 +27,14 @@
# Memcached support depends on the `dalli` gem.
#
# @param [String] cache_dir a directory or a Memcached address
# (e.g. `memcached://localhost:11211`) in which to cache requests
# @param [Integer] expires_in the cache's expiration time in seconds
+ # @param [Integer,String] value_max_bytes the maximum Memcached item size
# @param [String] level the log level
# @return [Faraday::Connection] a configured Faraday HTTP client
- def self.new(cache_dir: nil, expires_in: 86400, level: 'INFO') # 1 day
+ def self.new(cache_dir: nil, expires_in: 86400, value_max_bytes: 1048576, level: 'INFO') # 1 day
Faraday.new do |connection|
connection.request :url_encoded
connection.use Middleware::Logger, Logger.new('faraday', level: level)
connection.use Middleware::RaiseError # useful for breaking concurrent requests
@@ -56,10 +57,10 @@
if cache_dir
connection.response :caching do
address = cache_dir[%r{\Amemcached://(.+)\z}, 1]
if address
- ActiveSupport::Cache::MemCacheStore.new(address, expires_in: expires_in)
+ ActiveSupport::Cache::MemCacheStore.new(address, expires_in: expires_in, value_max_bytes: 1048576)
else
ActiveSupport::Cache::FileStore.new(cache_dir, expires_in: expires_in)
end
end
end