• 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

Object of class stdClass could not be converted to string error

Why i get wrong output for html markdown?

using random function but it's displaying duplicates

how to youtube api data to print in toolset metabox using a button click before save-post

Laravel multi auth - Authentication user provider [] is not defined

how to redirect the user back to desired URL after login page in PHP?

Handling expired token in Laravel

Fetch files from next cloud storage and display in Laravel website

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

Get all WooCommerce products within own plugin

Explain how this array transposing and flattening function works

SendGrid: Sending an email to multiple recipients without other emails being shown on the "to" field

Vimeo API: how to save a vimeo into a subfolder?

Parameter is not sent to Laravel route in Ajax

Laravel Mix Uncaught ReferenceError: $ is not defined

About Contact Privacy policy Terms and conditions