Sha256: 9fbbd032777e25fc8a5d10d86dd0bc6a02eb05c6999c53e8e52da256b668b364
Contents?: true
Size: 756 Bytes
Versions: 3
Compression:
Stored size: 756 Bytes
Contents
# frozen_string_literal: true # Use CityHash for fast hashing if it is available; use Digest::MD5 otherwise begin require 'cityhash' rescue LoadError unless RUBY_PLATFORM == 'java' warn(<<-NOTICE) ** Notice: CityHash was not loaded. ** For optimal performance, use of the cityhash gem is recommended. Run the following command, or add it to your Gemfile: gem install cityhash NOTICE end require 'digest/md5' end module IdentityCache module CacheHash if defined?(CityHash) def memcache_hash(key) #:nodoc: CityHash.hash64(key) end else def memcache_hash(key) #:nodoc: a = Digest::MD5.digest(key).unpack('LL') (a[0] << 32) | a[1] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
identity_cache-1.1.0 | lib/identity_cache/cache_hash.rb |
identity_cache-1.0.1 | lib/identity_cache/cache_hash.rb |
identity_cache-1.0.0 | lib/identity_cache/cache_hash.rb |