• 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

Two buttons one form

Reload parent page after submit in iframe

advanced custom fields wordpress custom class

The difference when using if statement true === something() vs something() === true [duplicate]

PHP web3 ERC20 token function call

PHPS source file - 403 Forbidden You don't have permission to access this resource

PHP Print to Network Printer

Don't show recurring price for WooCommerce subscriptions worth 0$

I want a way to give path to my files which are outside of public folder in laravel

PHP echo values of all sub keys [duplicate]

Implode array with array of glue strings

Implode columnar values between two arrays into a flat array of concatenated strings

How to use $this->session->set_userdata in codeigniter

Display a success custom notice after Placing an Order in WooCommerce

Composer fails with kylekatarnls/update-helper on new homestead

About Contact Privacy policy Terms and conditions