• 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

Laravel Blade checkbox not checked

Custom add to cart button URL for specific product in WooCommerce?

How to set dynamic `home` and `siteurl` in WordPress?

Losing session data after POST from third party website

how to upload binary image to sql server using php laravel

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

Edit XML in HTML form and submit to self

WordPress + Nginx on non-standard port behind AWS ELB results in broken links

Can I write PHP code across multiple lines per statement?

Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement

renameColumn migration fails for existing column with columns does not exist error

How to get company posts from LinkedIn via API?

How can I make this nested location configuration use the correct path to call a php program?

Laravel Unknown Column 'updated_at'

Telegram bot doesn't answer

About Contact Privacy policy Terms and conditions