new_contents: # -*- coding: utf-8 -*-
  
  
  
  
  #from itertools import izip
  from .posixemulation import _items
  
  
  
  
  class BaseCache(object):
      """Baseclass for the cache systems.  All the cache systems implement this
      API or a superset of it.
  
      :param default_timeout: the default timeout that is used if no timeout is
                              specified on :meth:`set`.
      """
  
      def __init__(self, default_timeout=300):
          self.default_timeout = default_timeout
  
      def get(self, key):
          """Looks up key in the cache and returns the value for it.
          If the key does not exist `None` is returned instead.
  
          :param key: the key to be looked up.
          """
          return None
  
      def delete(self, key):
          """Deletes `key` from the cache.  If it does not exist in the cache
          nothing happens.
  
          :param key: the key to delete.
          """
          pass
  
      def get_many(self, *keys):
          """Returns a list of values for the given keys.
          For each key a item in the list is created.  Example::
  
              foo, bar = cache.get_many("foo", "bar")
  
          If a key can't be looked up `None` is returned for that key
          instead.
  
          :param keys: The function accepts multiple keys as positional
                       arguments.
          """
          return map(self.get, keys)
  
      def get_dict(self, *keys):
          """Works like :meth:`get_many` but returns a dict::
  
              d = cache.get_dict("foo", "bar")
              foo = d["foo"]
              bar = d["bar"]
  
          :param keys: The function accepts multiple keys as positional
                       arguments.
          """
          #return dict(izip(keys, self.get_many(*keys)))
          return dict(zip(keys, self.get_many(*keys)))
  
      def set(self, key, value, timeout=None):
          """Adds a new key/value to the cache (overwrites value, if key already
          exists in the cache).
  
          :param key: the key to set
          :param value: the value for the key
          :param timeout: the cache timeout for the key (if not specified,
                          it uses the default timeout).
          """
          pass
  
      def add(self, key, value, timeout=None):
          """Works like :meth:`set` but does not overwrite the values of already
          existing keys.
  
          :param key: the key to set
          :param value: the value for the key
          :param timeout: the cache timeout for the key or the default
                          timeout if not specified.
          """
          pass
  
      def set_many(self, mapping, timeout=None):
          """Sets multiple keys and values from a mapping.
  
          :param mapping: a mapping with the keys/values to set.
          :param timeout: the cache timeout for the key (if not specified,
                          it uses the default timeout).
          """
          for key, value in _items(mapping):
              self.set(key, value, timeout)
  
      def delete_many(self, *keys):
          """Deletes multiple keys at once.
  
          :param keys: The function accepts multiple keys as positional
                       arguments.
          """
          for key in keys:
              self.delete(key)
  
      def clear(self):
          """Clears the cache.  Keep in mind that not all caches support
          completely clearing the cache.
          """
          pass
  
      def inc(self, key, delta=1):
          """Increments the value of a key by `delta`.  If the key does
          not yet exist it is initialized with `delta`.
  
          For supporting caches this is an atomic operation.
  
          :param key: the key to increment.
          :param delta: the delta to add.
          """
          self.set(key, (self.get(key) or 0) + delta)
  
      def dec(self, key, delta=1):
          """Decrements the value of a key by `delta`.  If the key does
          not yet exist it is initialized with `-delta`.
  
          For supporting caches this is an atomic operation.
  
          :param key: the key to increment.
          :param delta: the delta to subtract.
          """
          self.set(key, (self.get(key) or 0) - delta)
  
subject: Create basecache.py