Posts

Showing posts with the label redis

How to Install or Uninstall Redis on Ubuntu 18.04

Step 1 – Open the terminal step 2. Update APT Repository Cache   (1)check the version table on your operating system     The package you are searching for is named redis-server. You can check its package info with apt show redis-server sudo apt-cache policy redis-server or sudo apt show redis-server The dataset is stored entirely in memory and periodically flushed to disk. (2)add PPA repository to your OS: sudo add-apt-repository ppa:chris-lea/redis-server (3)In order to install Redis, you first need to update the APT repository cache of your Ubuntu. You can do that with the following command: Update the apt-get packages index files and also update existing packages to the newest versions by using the following commands: sudo apt-get update  sudo apt-get upgrade step 2. Install Redis on Ubuntu Using the APT Command sudo apt-get install redis-server step 3. Check Redis Version redis-cli --version step 4:check if the Redis is running. Once t

Create worker in rails by sidekiq and redis

Add sidekiq to your Gemfile: Add this to your Gemfile gem 'sidekiq' Run bundle install bundle install Create worker rails g sidekiq:worker Test #will create app/workers/test_worker.rb class TestWorker   include Sidekiq::Worker   def perform(id, name)     # do something   end end Call worker without any time boundation TestWorker.perform_async(5, 'rahul') //use this anywhere from your rails app(controller, model, helpers..) Call worker within particular time period TestWorker.perform_in(5.minutes, 5, 'rahul')  //use this anywhere from your rails app(controller, model, helpers..) Call worker after specific time interval once only TestWorker.perform_at(5.minutes.from_now, 5, 'rahul')  //use this anywhere from your rails app(controller, model, helpers..) Start sidekiq on development bundle exec sidekiq Start sidekiq on production bundle exec sidekiq -d //run this first if you get some error then use second one bundle exec si