• 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

hidden INPUT value not available in $_POST

How to unlink image from folder?

PHP password_verify

The difference when using if statement true === something() vs something() === true [duplicate]

Return multiple values from a function using mysqli_fetch_assoc [closed]

PHP sort array of objects by two properties

Google API Heatmap Layer exception, why?

HTTP Range requests with php for Video Embedding for solving going to specific time in video (seek bar not work)

codeigniter 4 running error first time with xampp

Error Class "LaravelFortifyFeatures" not found

correct PHP headers for pdf file download

Sliders in Laravel

PHPS source file - 403 Forbidden You don't have permission to access this resource

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

How to get quarter for future date using Carbon?

About Contact Privacy policy Terms and conditions