Module: Rex::Exploitation::OpcodeDb::Cachable

Included in:
Group, ImageModule, Locale, MetaType, OsVersion, Type
Defined in:
lib/rex/exploitation/opcodedb.rb

Overview

A cachable entry.

Instance Method Summary collapse

Instance Method Details

#create(hash) ⇒ Object

:nodoc:



27
28
29
30
31
32
33
34
# File 'lib/rex/exploitation/opcodedb.rb', line 27

def create(hash) # :nodoc:
  @Cache = {} unless (@Cache)
  if (hash_key(hash) and @Cache[hash_key(hash)])
    @Cache[hash_key(hash)]
  else
    @Cache[hash_key(hash)] = self.new(hash)
  end
end

#flush_cacheObject

:nodoc:



40
41
42
# File 'lib/rex/exploitation/opcodedb.rb', line 40

def flush_cache # :nodoc:
  @Cache.clear
end

#hash_key(hash) ⇒ Object

:nodoc:



36
37
38
# File 'lib/rex/exploitation/opcodedb.rb', line 36

def hash_key(hash) # :nodoc:
  hash['id'] || nil
end