• 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

Utf8 encoding issue with Laravel

display WooCommerce “Add to cart” button with short-code [add_to_cart ] dynamically

How to check user Permissions using Custom Middleware in Laravel

Laravel Pagination links() not working

Could not decode a text frame as UTF-8.

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

how to hide previous markers when new markers added in google map javascript api

How can i call a function that executes an fpdf based on the choice of a form selector?

how to use extended ASCII instead of unicode in PHP

Alert message after submitting form in PHP

Pass an image through AJAX [duplicate]

PHP: set a (deep) array key from an array [closed]

How can I create a Download Page with post php method?

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

How to convert time from one timezone to another in PHP

About Contact Privacy policy Terms and conditions