Get all keys matching the pattern :param pattern: Matching pattern :return:
(self, pattern: str)
| 81 | self._cache_container[key] = (value, time.time() + expire_time) |
| 82 | |
| 83 | def keys(self, pattern: str) -> List[str]: |
| 84 | """ |
| 85 | Get all keys matching the pattern |
| 86 | :param pattern: Matching pattern |
| 87 | :return: |
| 88 | """ |
| 89 | if pattern == '*': |
| 90 | return list(self._cache_container.keys()) |
| 91 | |
| 92 | # For local cache wildcard, temporarily replace * with empty string |
| 93 | if '*' in pattern: |
| 94 | pattern = pattern.replace('*', '') |
| 95 | |
| 96 | return [key for key in self._cache_container.keys() if pattern in key] |
| 97 | |
| 98 | def _schedule_clear(self): |
| 99 | """ |