{ "cells": [ { "cell_type": "raw", "metadata": {}, "source": [ "---\n", "sidebar_label: Redis\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# RedisStore\n", "\n", "The `RedisStore` is an implementation of `ByteStore` that stores everything in your Redis instance.\n", "\n", "To configure Redis, follow our [Redis guide](/docs/integrations/providers/redis)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%pip install --upgrade --quiet redis" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[b'v1', b'v2']\n" ] } ], "source": [ "from langchain.storage import RedisStore\n", "\n", "store = RedisStore(redis_url=\"redis://localhost:6379\")\n", "\n", "store.mset([(\"k1\", b\"v1\"), (\"k2\", b\"v2\")])\n", "print(store.mget([\"k1\", \"k2\"]))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.4" } }, "nbformat": 4, "nbformat_minor": 2 }