• 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

Is there a way to use Foundry Model for Authentification inside Functional Tests?

Laravel query builder binding parameters more than once

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

Pass an image through AJAX [duplicate]

How can i hide dt if dd got empty value

Add New Parameter to Existing URL using htaccess

Add 2 Webcam in one page with WebcamJS

Required field only if another field has a value, must be empty otherwise

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

How to Display Data in Yajra Datatables Laravel 7?

Filter WooCommerce products with post__in and additional meta queries

How to make a array inside array?

Add rows to Single product Additional information table in WooCommerce 3.6

phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO)

How to remove Deprecated SymfonyComponentDebugDebugClassLoader?

About Contact Privacy policy Terms and conditions