• 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

Limit WooCommerce products in cart only from one custom taxonomy

How can i update or reset my password without entering email field in laravel-8?

Transpose and flatten multiple rows of array data [duplicate]

How to use a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

Check for PDO Results, If None Display Message, If Yes then Loop Through

Having issue with matching rows in the database using PDO

What is PHP's equivalent of JavaScript's "array.every()"?

Laravel Displaying image from database

Laravel insert dynamic input values with radio button

Entity provider not working in security.yml php symfony3.4 ({"code":401,"message":"bad credentials"}.)

Cache clear probem in Larave

No result using makeStyles Material UI in react 18

Extract house numbers from address string

How to pass security cloudflare server with php curl

How to MODIFY a Google Docs document via API using search-and-replace?

About Contact Privacy policy Terms and conditions