• 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

Undefined Array Key error when uploading image on php

No result using makeStyles Material UI in react 18

Whats the point of running Laravel with the command 'php artisan serve'?

PHP Startup Unable to load dynamic library /usr/lib/php/20151012/php_mysqli.dll

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

No definition found for function in vendor vscode

Mysqli multi query error

PHP Startup: Unable to load dynamic library 'openssl' in Ubuntu

Laravel Excel::store file empty after stored

Remove country code from phone number?

How to submit the custom form data in database in WordPress without plugin using ajax?

Webscraping Symfony/Panther: Can't get HTML

Converting alphabet letter to alphabet position in PHP [duplicate]

How to convert time from one timezone to another in PHP

Fetch files from next cloud storage and display in Laravel website

About Contact Privacy policy Terms and conditions