예제 #1
0
    def __init__(self):
        if GroupPermissionCache.__instance:
            raise SingletonExistsException()
        self.mc = conf.getMemcachedInstance()

        # Cache times are seconds
        self.ID_CACHE_TIME = 15 * 60
        self.PERMISSION_CACHE_TIME = 5 * 60
    def __init__(self):
        if GroupPermissionCache.__instance:
            raise SingletonExistsException()
        self.mc = conf.getMemcachedInstance()

        # Cache times are seconds
        self.ID_CACHE_TIME = 15 * 60
        self.PERMISSION_CACHE_TIME = 5 * 60
예제 #3
0
    def _try_from_cache(identifier):
        """
        Static, private method for reading the TracEnvironment data from memcached. Returns just
        plain data, as it would be fetch from database, not the instance.

        :param identifier: The project environment identifier
        """
        mc = conf.getMemcachedInstance()
        key = TracEnvironment._mc_key(identifier)
        return mc.get(key)
예제 #4
0
    def _try_from_cache(identifier):
        """
        Static, private method for reading the TracEnvironment data from memcached. Returns just
        plain data, as it would be fetch from database, not the instance.

        :param identifier: The project environment identifier
        """
        mc = conf.getMemcachedInstance()
        key = TracEnvironment._mc_key(identifier)
        return mc.get(key)
예제 #5
0
    def _set_into_cache(identifier, row):
        """"
        Static, private method for setting the environment data into memcache daemon... as it is got
        from database.

        :param identifier: The project environment identifier
        :param row: The data for project in an array, environment identifier on first element, project
                    identifier on second element.
        """
        mc = conf.getMemcachedInstance()
        key = TracEnvironment._mc_key(identifier)
        return mc.set(key, row, 60 * 5)
예제 #6
0
    def _set_into_cache(identifier, row):
        """"
        Static, private method for setting the environment data into memcache daemon... as it is got
        from database.

        :param identifier: The project environment identifier
        :param row: The data for project in an array, environment identifier on first element, project
                    identifier on second element.
        """
        mc = conf.getMemcachedInstance()
        key = TracEnvironment._mc_key(identifier)
        return mc.set(key, row, 60 * 5)
예제 #7
0
 def __init__(self, env_name, base_url=None):
     """
     :param env_name: valid environment name aka identifier (not validated)
     :param base_url: the base url, like '/files'
     """
     self._downloads_dir = None
     self.env_name = env_name
     files_conf = FilesConfiguration()
     self.base_path = filesystem.get_normalized_base_path(
         filesystem.safe_path(files_conf.sys_dav_root, self.env_name))
     if base_url is not None:
         self.base_url = normalized_base_url(base_url)
     else:
         self.base_url = None
     if not files_conf.downloads_dir_customizable:
         self._downloads_dir_fetched = True
         self._default = files_conf.default_downloads_directory
         self._downloads_dir = self._default
     else:
         self._downloads_dir = None
         self._downloads_dir_fetched = False
         self._default = None
     self.mc = conf.getMemcachedInstance()
예제 #8
0
 def __init__(self, env_name, base_url=None):
     """
     :param env_name: valid environment name aka identifier (not validated)
     :param base_url: the base url, like '/files'
     """
     self._downloads_dir = None
     self.env_name = env_name
     files_conf = FilesConfiguration()
     self.base_path = filesystem.get_normalized_base_path(
         filesystem.safe_path(files_conf.sys_dav_root, self.env_name))
     if base_url is not None:
         self.base_url = normalized_base_url(base_url)
     else:
         self.base_url = None
     if not files_conf.downloads_dir_customizable:
         self._downloads_dir_fetched = True
         self._default = files_conf.default_downloads_directory
         self._downloads_dir = self._default
     else:
         self._downloads_dir = None
         self._downloads_dir_fetched = False
         self._default = None
     self.mc = conf.getMemcachedInstance()
예제 #9
0
 def __init__(self):
     if AuthenticationCache.__instance:
         raise SingletonExistsException()
     self.mc = conf.getMemcachedInstance()
     self.AUTHENTICATION_CACHE_TIME = 60
예제 #10
0
 def __init__(self):
     if EventCache.__instance:
         raise SingletonExistsException()
     self.mc = conf.getMemcachedInstance()
     self.EVENT_CACHE_TIME = 60
예제 #11
0
 def __init__(self):
     # 5 minutes
     self.LIFETIME = 300
     self.mc = conf.getMemcachedInstance()
예제 #12
0
 def __init__(self):
     if CookieCache.__instance:
         raise SingletonExistsException()
     self.mc = conf.getMemcachedInstance()
예제 #13
0
 def __init__(self):
     if UserCache.__instance:
         raise SingletonExistsException()
     self.mc = conf.getMemcachedInstance()
     self.USER_CACHE_TIME = 5 * 60
예제 #14
0
 def __init__(self):
     if ProjectCache.__instance:
         raise SingletonExistsException()
     self.mc = conf.getMemcachedInstance()
     self.PROJECT_CACHE_TIME = 5 * 60
     self.LIST_CACHE_TIME = 3 * 60
예제 #15
0
 def __init__(self):
     # 5 minutes
     self.LIFETIME = 300
     self.mc = conf.getMemcachedInstance()
예제 #16
0
 def set_project_protocols(self, project_id, type, protocols):
     mc = conf.getMemcachedInstance()
     mc.set(self.__key(project_id, type), protocols, self.CACHE_TIME)
예제 #17
0
 def __init__(self):
     if UserCache.__instance:
         raise SingletonExistsException()
     self.mc = conf.getMemcachedInstance()
     self.USER_CACHE_TIME = 5 * 60
예제 #18
0
 def __init__(self):
     self.TIMELINE_CACHE_TIME = 3600 * 24 * 7
     self.mc = conf.getMemcachedInstance()
예제 #19
0
 def get_project_protocols(self, project_id, type):
     mc = conf.getMemcachedInstance()
     return mc.get(self.__key(project_id, type))
 def __init__(self):
     if AuthenticationCache.__instance:
         raise SingletonExistsException()
     self.mc = conf.getMemcachedInstance()
     self.AUTHENTICATION_CACHE_TIME = 60
예제 #21
0
 def __init__(self):
     if EventCache.__instance:
         raise SingletonExistsException()
     self.mc = conf.getMemcachedInstance()
     self.EVENT_CACHE_TIME = 60
예제 #22
0
 def get_project_protocols(self, project_id, type):
     mc = conf.getMemcachedInstance()
     return mc.get(self.__key(project_id, type))
예제 #23
0
 def __init__(self):
     self.TIMELINE_CACHE_TIME = 3600 * 24 * 7
     self.mc = conf.getMemcachedInstance()
예제 #24
0
 def clear_project_protocols(self, project_id, type):
     mc = conf.getMemcachedInstance()
     mc.delete(self.__key(project_id, type))
예제 #25
0
 def __init__(self):
     if CategoryCache.__instance:
         raise SingletonExistsException()
     self.mc = conf.getMemcachedInstance()
     self.CATEGORY_CACHE_TIME = 5 * 60
예제 #26
0
 def clear_project_protocols(self, project_id, type):
     mc = conf.getMemcachedInstance()
     mc.delete(self.__key(project_id, type))
예제 #27
0
 def set_project_protocols(self, project_id, type, protocols):
     mc = conf.getMemcachedInstance()
     mc.set(self.__key(project_id, type), protocols, self.CACHE_TIME)
예제 #28
0
 def __init__(self):
     if CategoryCache.__instance:
         raise SingletonExistsException()
     self.mc = conf.getMemcachedInstance()
     self.CATEGORY_CACHE_TIME = 5 * 60