-4

is there any way to use queuing process and queuing jobs with Redis caching in php? Please let me know the right way to implement and which one is better redis or queuing?

astha
  • 245
  • 1
  • 3
  • 5
  • 1
    I would suggest adding more content to this question, to help us get to the answer that you need to resolve this problem. Please see: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) and review your question. In addition, StackOverflow is not a code writing service. StackOverflow will help to identify bugs, or faults in code, but will not come up with code for you. If you have attempted this yourself, please show us so that we can help. – Hopeful Llama Sep 01 '16 at 10:34

1 Answers1

1

Yes, you can. :)

There are a few basic Redis commands for working with lists and they are:

  • LPUSH: adds an element to the beginning of a list
  • RPUSH: add an element to the end of a list
  • LPOP: removes the first element from a list and returns it
  • RPOP: removes the last element from a list and returns it
  • LLEN: gets the length of a list
  • LRANGE: gets a range of elements from a list

Simple List Usage:

$redis->rpush("languages", "french"); // [french]
$redis->rpush("languages", "arabic"); // [french, arabic]

$redis->lpush("languages", "english"); // [english, french, arabic]
$redis->lpush("languages", "swedish"); // [swedish, english, french, arabic]

$redis->lpop("languages"); // [english, french, arabic]
$redis->rpop("languages"); // [english, french]

$redis->llen("languages"); // 2

$redis->lrange("languages", 0, -1); // returns all elements
$redis->lrange("languages", 0, 1); // [english, french]
Haresh Vidja
  • 8,340
  • 3
  • 25
  • 42