class_docstr: A class that is responsible for caching objects in-memory.
  
  This class is to intended to be used in the following pattern:
  
  def get(key, default=None):
      if not cache.has(key):
          try:
              data = load_data(key)
              cache.set(key, data)
          except NoSuchKeyException:
              cache.blank(key)
  
      return cache.get(key, default)
class_docstr_tok: ["A","class","that","is","responsible","for","caching","objects","in-memory",".","This","class","is","to","intended","to","be","used","in","the","following","pattern",":","def","get","(","key",",","default=None",")",":","if","not","cache.has","(","key",")",":","try",":","data","=","load_data","(","key",")","cache.set","(","key",",","data",")","except","NoSuchKeyException",":","cache.blank","(","key",")","return","cache.get","(","key",",","default",")"]
docstr: Sets the given value to the requested key. The key expires after ttl_minutes, relative to
  "now", as defined by the DriverCacheClock.
  
  Params:
      key (str)
      value (mixed)
      ttl_minutes (int)
docstr_tok: ["Sets","the","given","value","to","the","requested","key",".","The","key","expires","after","ttl_minutes",",","relative","to","''","now","''",",","as","defined","by","the","DriverCacheClock",".","Params",":","key","(","str",")","value","(","mixed",")","ttl_minutes","(","int",")"]
code: def set(self, key, value, ttl_minutes):
      """
      Sets the given value to the requested key. The key expires after ttl_minutes, relative to
      "now", as defined by the DriverCacheClock.
  
      Params:
          key (str)
          value (mixed)
          ttl_minutes (int)
      """
      if 0 < self._maximum_key_count < len(self._data) + 1:
          # Cache is too full, evict a random record
          # The reason for RANDOM eviction is that for a LRU cache replacement policy,
          # Cache pollution can occur for Lambdas that experience extremely deterministic
          # key loading orders.
          selected_key = random.choice(list(self._ttls.keys()))
          del self._ttls[selected_key]
          del self._data[selected_key]
  
      self._data[key] = value
      self._ttls[key] = self._clock.utcnow() + timedelta(
          minutes=ttl_minutes
      )
  
file_path: streamalert/streamalert/shared/lookup_tables/cache.py
imports: import copy
  from datetime import datetime, timedelta
  import random
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 5 for calling the DriverCache obj's underlying member method code with example usage: obj.set(key, value, ttl_minutes) without return types