• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Redis Command To Sort Keys

javascriptphpsortingredis


PHP Snippet 1:

EVAL "local keys = redis.call('KEYS','post:*');
      if (table.getn(keys) == 0) then return {} end;
      table.sort(keys);
      return redis.call('MGET',unpack(keys));"

PHP Snippet 2:

// a scoreless sorted set can be used as an index
SET post:1500 <value>
ZADD posts_index 0 post:1500

// Whenever you need a sorted (range) of items, you first check the index 
ZRANGE posts_index - + BYLEX 
ZRANGE posts_index [posts:1000 (posts:2000 BYLEX 

Related Snippets

Add New Parameter to Existing URL using htaccess

What is the difference between client-side and server-side programming?

How can I get a div content in php

Why getting "Build step 'Execute shell' marked build as failure" error while creating a backup tar for files

phpunit - testing is painfully slow

I want to display default profile image if user do not have profile image

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

Laravel: Create morphs() relationship nullable

WooCommerce - unset "<product> removed notice…" on cart page

How to increase the PHP upload limits [duplicate]

PHP my timezone is no setting up in PHP.ini File in xampp

php retrieve specific data onclick from database in a list format

Problem with fetching data from database in Laravel

Unit (real unit test) of test laravel relationship

How to get the ID of the link in another page in php

About Contact Privacy policy Terms and conditions