• 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

Malformed MIME header error in Symfony 5.3

Laravel - Browser displays message again when I press back button

Custom Button next to “ADD TO CART” button of WooCommerce based on Product Type

How to give apache permission to write to home directory?

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Why does using salted hash on python and php give me different results?

How to change 'users' auth table and use another instead Laravel

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

Zig-zag scan an N x N array

PHP array stringify

How to test laravel controller method?

add_action() function in wordpress not working [duplicate]

woocommerce change position of price

Laravel Nova, route not found

Make Calculator - When Button clicked the No shows in Textbox.

About Contact Privacy policy Terms and conditions