Module: Looksist

Extended by:
ActiveSupport::Concern
Includes:
Core, Hashed
Defined in:
lib/looksist.rb,
lib/looksist/core.rb,
lib/looksist/common.rb,
lib/looksist/hashed.rb,
lib/looksist/redis_service.rb,
lib/looksist/safe_lru_cache.rb

Defined Under Namespace

Modules: Common, Core, Hashed, Serializers Classes: RedisService, SafeLruCache

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Common

#__entity__

Methods included from Core

#as_json

Class Attribute Details

.cache_buffer_sizeObject

Returns the value of attribute cache_buffer_size.



19
20
21
# File 'lib/looksist.rb', line 19

def cache_buffer_size
  @cache_buffer_size
end

.driverObject

Returns the value of attribute driver.



19
20
21
# File 'lib/looksist.rb', line 19

def driver
  @driver
end

.l2_cacheObject

Returns the value of attribute l2_cache.



19
20
21
# File 'lib/looksist.rb', line 19

def l2_cache
  @l2_cache
end

.lookup_storeObject

Returns the value of attribute lookup_store.



19
20
21
# File 'lib/looksist.rb', line 19

def lookup_store
  @lookup_store
end

.redis_serviceObject

Returns the value of attribute redis_service.



19
20
21
# File 'lib/looksist.rb', line 19

def redis_service
  @redis_service
end

Class Method Details

.bucket_dump(entity) ⇒ Object



29
30
31
32
33
# File 'lib/looksist.rb', line 29

def bucket_dump(entity)
  keys = Looksist.lookup_store.keys("#{entity.pluralize}*")
  values = Looksist.redis_service.send("#{entity}_for", keys.collect{|i| i.split('/').last})
  Hash[(keys.collect {|i| i.split('/').last}).zip(values)]
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Looksist)

    the object that the method was called on



21
22
23
24
25
26
27
# File 'lib/looksist.rb', line 21

def configure
  yield self
  self.redis_service = Looksist::RedisService.instance do |lookup|
    lookup.client = self.lookup_store
    lookup.buffer_size = (self.l2_cache == :no_cache) ? 0 : (self.cache_buffer_size || 50000)
  end
end