• 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

Inserting Country Selection into MySQL PHP [duplicate]

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

Adding reCAPTCHA v2 into my PHP file

No definition found for function in vendor vscode

AJAX call fails with SyntaxError: Unexpected end of JSON input

Laravel 5 controller sending JSON integer as string

Laravel php artisan serve to mimic HTTPS

php 7 php.ini upload_max_filesize not working

Remove "estimated for {country}" text after tax amount in Woocommerce checkout page

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

How do I get friend list from Friends table with counts of friends of my friends

How to change the app environment at run time?

PHP - Store information with NO database

How to edit Records using CodeIgniter

About Contact Privacy policy Terms and conditions