Exemple #1
0
    def _normalize_timeout(self, timeout):
        timeout = BaseCache._normalize_timeout(self, timeout)
        if timeout > 0:
            # NOTE: pylibmc expect the timeout as delta time up to
            # 2592000 seconds (30 days)
            if not hasattr(self, "mc_library"):
                try:
                    import pylibmc  # noqa
                except ImportError:
                    self.mc_library = None
                else:
                    self.mc_library = "pylibmc"

            if self.mc_library != "pylibmc":
                timeout = int(time()) + timeout
            elif timeout > 2592000:
                timeout = 0

        return timeout
Exemple #2
0
 def _normalize_timeout(self, timeout):
     timeout = BaseCache._normalize_timeout(self, timeout)
     if timeout == 0:
         timeout = -1
     return timeout
 def _normalize_timeout(self, timeout):
     timeout = BaseCache._normalize_timeout(self, timeout)
     if timeout != 0:
         timeout = time() + timeout
     return int(timeout)
Exemple #4
0
 def _normalize_timeout(self, timeout):
     timeout = BaseCache._normalize_timeout(self, timeout)
     if timeout > 0:
         timeout = int(time()) + timeout
     return timeout
Exemple #5
0
 def _normalize_timeout(self, timeout):
     timeout = BaseCache._normalize_timeout(self, timeout)
     if timeout > 0:
         timeout = time() + timeout
     return timeout
Exemple #6
0
 def _normalize_timeout(self, timeout):
     timeout = BaseCache._normalize_timeout(self, timeout)
     if timeout == 0:
         timeout = -1
     return timeout