.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.cache.ExpireCacheStats Class Reference

Public Member Functions

 report (self)

Static Public Attributes

dict cached_items [str, list[tuple[str, typing.Any, int]]]

Detailed Description

Dataclass which provides information on the status of the cache.

Definition at line 81 of file cache.py.

Member Function Documentation

◆ report()

searx.cache.ExpireCacheStats.report ( self)

Definition at line 99 of file cache.py.

99 def report(self):
100 c_ctx = 0
101 c_kv = 0
102 lines: list[str] = []
103
104 for ctx_name, kv_list in self.cached_items.items():
105 c_ctx += 1
106 if not kv_list:
107 lines.append(f"[{ctx_name:20s}] empty")
108 continue
109
110 for key, value, expire in kv_list:
111 valid_until = datetime.datetime.fromtimestamp(expire).strftime("%Y-%m-%d %H:%M:%S")
112 c_kv += 1
113 lines.append(f"[{ctx_name:20s}] {valid_until} {key:12}" f" --> ({type(value).__name__}) {value} ")
114
115 lines.append(f"Number of contexts: {c_ctx}")
116 lines.append(f"number of key/value pairs: {c_kv}")
117 return "\n".join(lines)
118
119

References cached_items.

Member Data Documentation

◆ cached_items

dict searx.cache.ExpireCacheStats.cached_items [str, list[tuple[str, typing.Any, int]]]
static

Definition at line 84 of file cache.py.

Referenced by report().


The documentation for this class was generated from the following file:
  • /home/andrew/Documents/code/public/searxng/searx/cache.py