def add(self, key = None, value = None, timeout = None):
        """
        Adds an entry to the cache, if one does not already exist. If they key
        already exists, KeyError will be raised.

        Args:
            key: Key name of the cache object
            value: Value of the cache object
            timeout: timeout value for the cache object.

        Returns the cache object.
        """
        self._validate_key(key)
        self._validate_value(value)
        timeout = self._validate_timeout(timeout)

        if key in self:
            raise KeyError

        cacheEntry = _AppEngineUtilities_Cache()
        cacheEntry.cachekey = key
        cacheEntry.value = pickle.dumps(value)
        cacheEntry.timeout = timeout

        # try to put the entry, if it fails silently pass
        # failures may happen due to timeouts, the datastore being read
        # only for maintenance or other applications. However, cache
        # not being able to write to the datastore should not
        # break the application
        try:
            cacheEntry.put()
        except:
            pass

        memcache_timeout = timeout - datetime.datetime.now()
        memcache.set('cache-%s' % (key), value, int(memcache_timeout.seconds))

        if 'AEU_Events' in __main__.__dict__:
            __main__.AEU_Events.fire_event('cacheAdded')

        return self.get(key)
dataset/ETHPy150Open CollabQ/CollabQ/common/appengine_utilities/cache.py/Cache.add/original