.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 83 of file cache.py.

Member Function Documentation

◆ report()

searx.cache.ExpireCacheStats.report ( self)

Definition at line 101 of file cache.py.

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

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 86 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