• 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

phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO)

Laravel no logout option from menu after successfull login

How to redirect to another page and call a Function there on Angular ng-click

Laravel PHP: multiple project run at the same time [closed]

Laravel Command Schedule Not Working Properly

How to assert parameter attribute sub-structures in PHPUnit mock call expectations

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

Sum column values from multiple arrays

Can't exclude directories from .htaccess mobile redirect?

woocommerce get_order_report_data to show order_item_id

Cache clear probem in Larave

PHP error: "The zip extension and unzip command are both missing, skipping."

Store / Website Column in Magento 2 Admin Grid - Custom Module

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given [duplicate]

Message: Set sys_temp_dir in your php.ini after installed composer

About Contact Privacy policy Terms and conditions