Skip to content

CacheMode

onvif.operator.CacheMode

Bases: Enum

0.0.1 Utility enum

WSDL caching strategies for ONVIF client performance optimization.

Different caching modes provide trade-offs between performance, memory usage, and disk storage. Choose based on the application's requirements.

Attributes:

Name Type Description
NONE Literal['none']

No caching; WSDL and XSD documents are fetched fresh.

MEM Literal['mem']

In-memory caching for the lifetime of the process.

DB Literal['db']

Persistent SQLite caching across process restarts.

Version History

  • Removed in v0.4.0: CacheMode.ALL
Source code in onvif/operator.py
class CacheMode(Enum):
    """
    <!-- md:version 0.0.1 -->
    <!-- md:utility Utility enum-->

    WSDL caching strategies for ONVIF client performance optimization.

    Different caching modes provide trade-offs between performance, memory usage,
    and disk storage. Choose based on the application's requirements.

    Attributes:
        NONE (Literal['none']): No caching; WSDL and XSD documents are fetched fresh.
        MEM (Literal['mem']): In-memory caching for the lifetime of the process.
        DB (Literal['db']): Persistent SQLite caching across process restarts.

    !!! tip "Version History"
        - Removed in [`v0.4.0`](/onvif-python/releases/#v0.4.0): `CacheMode.ALL`
    """

    NONE = "none"
    """
    No cache.

    Uses Zeep's default transport without a cache backend.

    :material-check-circle:{ .success } Simplest configuration

    :material-alert-circle:{ .danger } WSDL/XSD documents are fetched without caching

    !!! bug "Use case"
        Debugging, testing, and situations where fresh WSDL/XSD documents
        are required.
    """

    MEM = "mem"
    """
    In-memory cache.

    Uses Zeep's `InMemoryCache` (`zeep.cache.InMemoryCache`) backend.

    :material-check-circle:{ .success } Fast process-local WSDL/XSD reuse

    :material-check-circle:{ .success } No disk I/O

    :material-alert-circle:{ .danger } Cache is lost when the process exits

    !!! bug "Use case"
        Long-running applications, temporary sessions, and applications
        where persistent cache storage is not required.
    """

    DB = "db"
    """
    Persistent SQLite cache.

    Uses Zeep's `SqliteCache` (`zeep.cache.SqliteCache`) backend.

    :material-check-circle:{ .success } Persistent across process restarts

    :material-check-circle:{ .success } Reduces repeated WSDL/XSD downloads

    :material-alert-circle:{ .danger } Requires disk I/O and a writable cache directory

    !!! bug "Use case"
        Production applications, CLI tools, and environments where
        WSDL/XSD caching should persist across restarts.
    """

NONE class-attribute instance-attribute

NONE = 'none'

No cache.

Uses Zeep's default transport without a cache backend.

Simplest configuration

WSDL/XSD documents are fetched without caching

Use case

Debugging, testing, and situations where fresh WSDL/XSD documents are required.

MEM class-attribute instance-attribute

MEM = 'mem'

In-memory cache.

Uses Zeep's InMemoryCache (zeep.cache.InMemoryCache) backend.

Fast process-local WSDL/XSD reuse

No disk I/O

Cache is lost when the process exits

Use case

Long-running applications, temporary sessions, and applications where persistent cache storage is not required.

DB class-attribute instance-attribute

DB = 'db'

Persistent SQLite cache.

Uses Zeep's SqliteCache (zeep.cache.SqliteCache) backend.

Persistent across process restarts

Reduces repeated WSDL/XSD downloads

Requires disk I/O and a writable cache directory

Use case

Production applications, CLI tools, and environments where WSDL/XSD caching should persist across restarts.

Comments