.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 wich provides information on the status of the cache.

Definition at line 82 of file cache.py.

Member Function Documentation

◆ report()

searx.cache.ExpireCacheStats.report ( self)

Definition at line 100 of file cache.py.

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

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

Referenced by report().


The documentation for this class was generated from the following file: