We are going to use the Memcached backend. Memcached runs in memory and it is allotted a specified amount of RAM. When the allotted RAM is full, Memcached starts removing the oldest data to store new data.
Download Memcached from https://memcached.org/downloads. If you are using Linux, you can install Memcached using the following command:
./configure && make && make test && sudo make install
If you are using macOS X, you can install Memcached with the Homebrew package
manager using the command brew install memcached. You can download Homebrew from https://brew.sh/.
After installing Memcached, open a shell and start it using the following command:
memcached -l 127.0.0.1:11211
Memcached will run on port 11211 by default. However, you can specify a custom host and port by using the -l option. You can find more information about Memcached at https://memcached.org.
After installing Memcached, you have to install its Python bindings. You can do it with the following command:
pip install python-memcached==1.59