redis_admin package

Submodules

redis_admin.settings module

redis_admin.settings.CROP_SIZE = 150

The maximum amount of characters to show before cropping them in the admin list view

redis_admin.settings.JSON_MODULE = <module 'json' from '/home/docs/.pyenv/versions/3.7.1/lib/python3.7/json/__init__.py'>

Can be any importable module that has a loads and dumps function

redis_admin.settings.SENTINELS = []

The REDIS_SENTINELS setting should be a list containing host/port combinations. As documented here: https://github.com/andymccurdy/redis-py/blob/master/README.rst#sentinel-support For example: [(‘server_a’, 26379), (‘server_b’, 26379)]

redis_admin.settings.SENTINEL_OPTIONS = {'socket_timeout': 0.3}

The REDIS_SENTINEL_OPTIONS are the extra arguments to redis.sentinel.Sentinel: https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/sentinel.py#L128-L155

redis_admin.settings.SERVERS = {'default': {}}

To use a separate master/slave configuration master/slave sub-dictionaries can be provided. Otherwise the top-level dictionary will be passed along to redis.Redis: https://redis-py.readthedocs.io/en/latest/index.html#redis.Redis

redis_admin.settings.SOCKET_TIMEOUT = 0.3

Default socket timeout if no other settings are given.

redis_admin.client module

redis_admin.client.get_master(name) → redis.client.Redis[source]
redis_admin.client.get_sentinel()[source]
redis_admin.client.get_slave(name) → redis.client.Redis[source]

redis_admin.models module

class redis_admin.models.Default(key, raw_value, type, expires_at, idle_since, base64, json)

Bases: redis_admin.models.RedisValue

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

objects = <django.db.models.manager.Manager object>
class redis_admin.models.Meta[source]

Bases: redis_admin.models.RedisMeta

class redis_admin.models.RedisHash(key, raw_value, type, expires_at, idle_since, base64, json)[source]

Bases: redis_admin.models.RedisValue

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

fetch_value(client: redis.client.Redis)[source]

Fetch the value. Note that if a pipe is passed as client the result will be in the pipe.execute() instead

objects = <django.db.models.manager.Manager object>
rediszset

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

value
class redis_admin.models.RedisList(key, raw_value, type, expires_at, idle_since, base64, json)[source]

Bases: redis_admin.models.RedisValue

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

fetch_value(client: redis.client.Redis)[source]

Fetch the value. Note that if a pipe is passed as client the result will be in the pipe.execute() instead

objects = <django.db.models.manager.Manager object>
redisset

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

value
class redis_admin.models.RedisMeta[source]

Bases: object

get_field(name)[source]
managed = False
class redis_admin.models.RedisSet(key, raw_value, type, expires_at, idle_since, base64, json, redislist_ptr)[source]

Bases: redis_admin.models.RedisList

exception DoesNotExist

Bases: redis_admin.models.DoesNotExist

exception MultipleObjectsReturned

Bases: redis_admin.models.MultipleObjectsReturned

fetch_value(client: redis.client.Redis)[source]

Fetch the value. Note that if a pipe is passed as client the result will be in the pipe.execute() instead

redislist_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

redislist_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

value
class redis_admin.models.RedisString(key, raw_value, type, expires_at, idle_since, base64, json)[source]

Bases: redis_admin.models.RedisValue

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

fetch_value(client: redis.client.Redis)[source]

Fetch the value. Note that if a pipe is passed as client the result will be in the pipe.execute() instead

objects = <django.db.models.manager.Manager object>
value
class redis_admin.models.RedisValue(*args, **kwargs)[source]

Bases: django.db.models.base.Model

class Meta[source]

Bases: redis_admin.models.RedisMeta

abstract = False
TYPES = {'hash': <class 'redis_admin.models.RedisHash'>, 'list': <class 'redis_admin.models.RedisList'>, 'set': <class 'redis_admin.models.RedisSet'>, 'string': <class 'redis_admin.models.RedisString'>, 'zset': <class 'redis_admin.models.RedisZSet'>}
base64

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod create(type, **kwargs)[source]
cropped_value
decode_string(raw_value)[source]
expires_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fetch_value(client: redis.client.Redis)[source]

Fetch the value. Note that if a pipe is passed as client the result will be in the pipe.execute() instead

get_cropped_value(crop_size)[source]
idle
idle_since

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

json

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

key

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

raw_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod register_type(type)[source]
ttl
type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

value
class redis_admin.models.RedisZSet(key, raw_value, type, expires_at, idle_since, base64, json, redishash_ptr)[source]

Bases: redis_admin.models.RedisHash

exception DoesNotExist

Bases: redis_admin.models.DoesNotExist

exception MultipleObjectsReturned

Bases: redis_admin.models.MultipleObjectsReturned

fetch_value(client: redis.client.Redis)[source]

Fetch the value. Note that if a pipe is passed as client the result will be in the pipe.execute() instead

redishash_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

redishash_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

value
redis_admin.models.decode_bytes(value, encoding='utf-8', method='replace')[source]

redis_admin.admin module

class redis_admin.admin.Query(queryset)[source]

Bases: object

order_by = ()
class redis_admin.admin.Queryset(model: redis_admin.models.RedisValue, slice_limit=101)[source]

Bases: object

count()[source]
filter(*filters, **raw_filters)[source]
get(*args, **kwargs)[source]
order_by(*args, **kwargs)[source]
class redis_admin.admin.RedisAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

list_display = ['key', 'type', 'expires_at', 'ttl', 'idle', 'cropped_value', 'json', 'base64']
media
readonly_fields = ['key', 'raw_value', 'type', 'expires_at', 'idle_since', 'base64', 'json']
search_fields = ('key__contains',)
show_full_result_count = False
redis_admin.admin.grouper(iterable, n, fillvalue=None)[source]