Redis Store is a toolkit designed for Ruby applications that supports fragmentation, master-slave copying, marshalling, and timeouts and namespaces. In addition, it is also very easy to use on the Ruby on Rails.
How to use:
for using the Redis Store on rails, first we need to add a portal to the Gemfile file
Gem ' redis-rails '
gem ' redis-rack-cache ' # optional
Then we will have the following choices:
# # Cache Store
# config/environments/production.rb
config.cache_store =: Redis_store
# # Session Store
# config/initializers/session_store.rb
Myapplication::application.config.session_store:redis_store,
servers: [' redis://:secret@192.168.6.23:6379/ 0 ', ' REDIS://:SECRET@192.168.6.99:6379/1 ']
# # HTTP Cache
# config.ru
require ' rack '
require ' Rack/cache '
require ' redis-rack-cache ' use
rack::cache,
metastore: ' redis://localhost:6379/0/ Metastore ',
entitystore: ' Redis://localhost:6380/0/entitystore '
As you can see, using this plugin is fairly straightforward, but now I'm going to show you how to manage these settings.
The first case speaks for itself, and we say we use Activesupport to load the Redis Store. Keep in mind that Redis's contraire only supports strings, so you can use serialization and deserialization techniques to store any object.
The second case here is a little bit more complicated. First, we need to use a server cluster. Again, the Redis store supports fragmentation, which means that HTTP sessions are transparently visible between the two servers.
The final case is mainly about Ruby's HTTP caching proxies, which are designed to speed up HTTP responses, and also store meta data and entity entity objects in a name-value pair, and mention here that if we're storing plain string literals, Mashalling modules also do not need to be started.
Despite all that, the above points are just a small part of all the Redis store's features, but it also supports Rack,sinatra and i18n.
Summarize
I personally think that Redis is basically your server environment must use a plug-in, it is fast and can use a wide range, such as database, caching, slicing machine and so on, it is a good tool. However, there is a cost to any benefit: like rails, you have to spend a lot of time and installation and configuration to find the perfect balance between performance and memory usage.