• 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

Set quantity minimum, maximum and step at product level in Woocommerce

How can I get user id from session in javascript?

PHP - Store information with NO database

phpunit - testing is painfully slow

Hi, I am making a contact form thingy, and my php isn't working any reason why?

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

How can I make Laravel return a custom error for a JSON REST API

add_action() function in wordpress not working [duplicate]

get attribute from class not working php 7

Laravel display validation error

Add Metadata, headers (Expires, CacheControl) to a file uploaded to Amazon S3 using the Laravel 5.0 Storage facade

Woocommerce product attributes with hierarchy like categories

Get sum of arrays inside array

How to get multiple values with same key from an array PHP

PHP block shortcut in Visual Studio Code

About Contact Privacy policy Terms and conditions