• 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

How to write PHP in XSLT

CodeIgniter force_download is not working

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

PHP echo values of all sub keys [duplicate]

Two buttons one form

How to convert binary string to normal string in php

How to upload mpdf file after generating to s3 bucket in php

Json_Encode not returning html even i try to encode JSON_HEX_QUOT | JSON_HEX_TAG

php curl_exec() Connection refused when retrieving a remote image

Hide email address with stars (*)

AJAX call fails with SyntaxError: Unexpected end of JSON input

Get number of working days between two dates in PHP [duplicate]

Only on Firefox "Loading failed for the <script> with source"

How to show selected value using javascript in laravel

How can I create a Download Page with post php method?

About Contact Privacy policy Terms and conditions