.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.favicons.cache.FaviconCache Class Reference
+ Inheritance diagram for searx.favicons.cache.FaviconCache:
+ Collaboration diagram for searx.favicons.cache.FaviconCache:

Public Member Functions

 __init__ (self, FaviconCacheConfig cfg)
 
None|tuple[None|bytes, None|str] __call__ (self, str resolver, str authority)
 
bool set (self, str resolver, str authority, str|None mime, bytes|None data)
 
FaviconCacheStats state (self)
 
 maintenance (self, force=False)
 

Detailed Description

Abstract base class for the implementation of a favicon cache.

Definition at line 183 of file cache.py.

Constructor & Destructor Documentation

◆ __init__()

searx.favicons.cache.FaviconCache.__init__ ( self,
FaviconCacheConfig cfg )
An instance of the favicon cache is build up from the configuration.

Reimplemented in searx.favicons.cache.FaviconCacheMEM, searx.favicons.cache.FaviconCacheNull, and searx.favicons.cache.FaviconCacheSQLite.

Definition at line 187 of file cache.py.

187 def __init__(self, cfg: FaviconCacheConfig):
188 """An instance of the favicon cache is build up from the configuration."""
189

Member Function Documentation

◆ __call__()

None | tuple[None | bytes, None | str] searx.favicons.cache.FaviconCache.__call__ ( self,
str resolver,
str authority )
Returns ``None`` or the tuple of ``(data, mime)`` that has been
registered in the cache.  The ``None`` indicates that there was no entry
in the cache.

Reimplemented in searx.favicons.cache.FaviconCacheMEM, searx.favicons.cache.FaviconCacheNull, and searx.favicons.cache.FaviconCacheSQLite.

Definition at line 191 of file cache.py.

191 def __call__(self, resolver: str, authority: str) -> None | tuple[None | bytes, None | str]:
192 """Returns ``None`` or the tuple of ``(data, mime)`` that has been
193 registered in the cache. The ``None`` indicates that there was no entry
194 in the cache."""
195

◆ maintenance()

searx.favicons.cache.FaviconCache.maintenance ( self,
force = False )
Performs maintenance on the cache

Reimplemented in searx.favicons.cache.FaviconCacheMEM, searx.favicons.cache.FaviconCacheNull, and searx.favicons.cache.FaviconCacheSQLite.

Definition at line 207 of file cache.py.

207 def maintenance(self, force=False):
208 """Performs maintenance on the cache"""
209
210

Referenced by searx.favicons.cache.FaviconCacheSQLite.set().

+ Here is the caller graph for this function:

◆ set()

bool searx.favicons.cache.FaviconCache.set ( self,
str resolver,
str authority,
str | None mime,
bytes | None data )
Set data and mime-type in the cache.  If data is None, the
:py:obj:`FALLBACK_ICON` is registered. in the cache.

Reimplemented in searx.favicons.cache.FaviconCacheMEM, searx.favicons.cache.FaviconCacheNull, and searx.favicons.cache.FaviconCacheSQLite.

Definition at line 197 of file cache.py.

197 def set(self, resolver: str, authority: str, mime: str | None, data: bytes | None) -> bool:
198 """Set data and mime-type in the cache. If data is None, the
199 :py:obj:`FALLBACK_ICON` is registered. in the cache."""
200

◆ state()

FaviconCacheStats searx.favicons.cache.FaviconCache.state ( self)
Returns a :py:obj:`FaviconCacheStats` (key/values) with information
on the state of the cache.

Reimplemented in searx.favicons.cache.FaviconCacheMEM, searx.favicons.cache.FaviconCacheNull, and searx.favicons.cache.FaviconCacheSQLite.

Definition at line 202 of file cache.py.

202 def state(self) -> FaviconCacheStats:
203 """Returns a :py:obj:`FaviconCacheStats` (key/values) with information
204 on the state of the cache."""
205

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