<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def upsert(self, key, value, ttl=None):
 """ Perform an upsert on the cache Returns CACHE_DISABLED if the cache is disabled Returns True on successful operation :param key: key to store the value under :param value: value to cache :param ttl: optional expiry in seconds (defaults to None) """

        if not self.options.enabled:
            return CACHE_DISABLED
        logger.debug('upsert({}, {}, ttl={})'.format(repr(key), repr(value), ttl))
        self._dict[key] = MicrocacheItem(value, ttl)
        return True