moo.shell.history.RedisHistory

class moo.shell.history.RedisHistory(user_pk, cap=500, ttl=7776000)

prompt_toolkit History backed by the Django cache, scoped per Django user.

Entries are stored as a list under moo:history:{user_pk}, capped at cap entries and refreshed with ttl seconds on every write so abandoned accounts eventually expire.

__init__(user_pk, cap=500, ttl=7776000)

Methods

__init__(user_pk[, cap, ttl])

append_string(string)

Add string to the history.

get_strings()

Get the strings from the history that are loaded so far.

load()

Load the history and yield all the entries in reverse order (latest, most recent history entry first).

load_history_strings()

This should be a generator that yields str instances.

store_string(string)

Store the string in persistent storage.