Type stubs for Google Cloud NDB Redis caching functionality - provides Redis cache implementation for NDB operations
npx @tessl/cli install tessl/pypi-google-cloud-ndb-redis@2.3.0Type stubs for Google Cloud NDB's Redis caching functionality. This package provides type annotations for the RedisCache class, which enables Redis-based global caching for Google Cloud NDB operations.
pip install google-cloud-ndbfrom google.cloud.ndb import RedisCacheComplete import for global cache types:
from google.cloud.ndb import GlobalCache, RedisCache, MemcacheCachefrom google.cloud.ndb import RedisCache
import redis
# Create Redis client
redis_client = redis.Redis(host='localhost', port=6379, db=0)
# Create Redis cache for NDB operations
cache = RedisCache(redis_client, strict_read=True, strict_write=True)
# Use with NDB context (typical usage)
from google.cloud import ndb
client = ndb.Client()
with client.context(global_cache=cache):
# Your NDB operations will now use Redis caching
passThe Google Cloud NDB Redis cache implementation provides a Redis-backed global cache for NDB operations:
Redis-backed global cache implementation for Google Cloud NDB with support for all standard cache operations.
class RedisCache(GlobalCache):
transient_errors: Any
redis: Any
strict_read: Any
strict_write: Any
def __init__(self, redis, strict_read: bool = ..., strict_write: bool = ...) -> None: ...
@classmethod
def from_environment(cls, strict_read: bool = ..., strict_write: bool = ...) -> Self: ...
@property
def pipes(self): ...
def get(self, keys): ...
def set(self, items, expires: Incomplete | None = ...) -> None: ...
def delete(self, keys) -> None: ...
def watch(self, items) -> None: ...
def unwatch(self, keys) -> None: ...
def compare_and_swap(self, items, expires: Incomplete | None = ...) -> None: ...
def clear(self) -> None: ...import abc
from _typeshed import Incomplete
from typing import Any
from typing_extensions import Self
class GlobalCache(metaclass=abc.ABCMeta):
"""Abstract base class for global cache implementations."""
__metaclass__: Any
transient_errors: Any
strict_read: bool
strict_write: bool
@abc.abstractmethod
def get(self, keys): ...
@abc.abstractmethod
def set(self, items, expires: Incomplete | None = ...): ...
@abc.abstractmethod
def delete(self, keys): ...
@abc.abstractmethod
def watch(self, items): ...
@abc.abstractmethod
def unwatch(self, keys): ...
@abc.abstractmethod
def compare_and_swap(self, items, expires: Incomplete | None = ...): ...
@abc.abstractmethod
def clear(self): ...
class RedisCache(GlobalCache):
"""Redis implementation of GlobalCache for NDB operations."""
transient_errors: Any
redis: Any
strict_read: Any
strict_write: Any
def __init__(self, redis, strict_read: bool = ..., strict_write: bool = ...) -> None: ...
@classmethod
def from_environment(cls, strict_read: bool = ..., strict_write: bool = ...) -> Self: ...