lib/riak/cache_store.rb in riak-client-0.8.2 vs lib/riak/cache_store.rb in riak-client-0.8.3

- old
+ new

@@ -10,10 +10,16 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'riak' +require 'active_support/version' +if ActiveSupport::VERSION::STRING < "3.0.0" + raise LoadError, "ActiveSupport 3.0.0 or greater is required to use Riak::CacheStore." +else + require 'active_support/cache' +end module Riak # An ActiveSupport::Cache::Store implementation that uses Riak. # Compatible only with ActiveSupport version 3 or greater. class CacheStore < ActiveSupport::Cache::Store @@ -69,10 +75,10 @@ def read_entry(key, options={}) begin bucket.get(key).data rescue Riak::FailedRequest => fr - raise fr unless fr.code == 404 + raise fr unless fr.code.to_i == 404 nil end end def delete_entry(key, options={})