• 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

How to prevent phpmailer sending embedded image as an attachment on Gmail?

How to create a scheduler application in php

How to give apache permission to write to home directory?

codeigniter 4 running error first time with xampp

How to get unique slug to same post-title for other time too?

PHP header location absolute URL

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

Hide email address with stars (*)

How to set time with DateTime modify?

get folder directory from input type file - PHP

Mobile browsers are adding .html to filename on download

How to get transaction details in notify_url page in paypal

How do I loop through an MS SQL database with VB.NET?

How to show a popup modal in codeIgniter?

Return new collection without modifying original collection

About Contact Privacy policy Terms and conditions