• 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

stay with the last 15 elements of an array [duplicate]

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

MySQL default time format UTC or GMT?

Submitting a form with ajax in Wordpress

Insert database rows from columns of data from associative array of indexed arrays

Confirm Leave on External Links in Wordpress

Phalcon: setStatusCode returns empty response

How to make autocomplete work in foreach php loop? (vscode, intellisense)

Alert message after submitting form in PHP

I'm trying to use curl with php but getting this error:Could not resolve host: Bearer

Create a new line whenever an array value reaches more than 10 characters

Google API Heatmap Layer exception, why?

Results page in other window

PHP contact form configuration [duplicate]

How can I remove the "Advanced" panel of all blocks in WordPress block editor?

About Contact Privacy policy Terms and conditions