• 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

browsersync doesn't work with XAMPP

PHP Download MP3 files from directory on server

Pagekite error: FAIL: localhost:8080 is down

500 (Internal Server Error) with Laravel & Docker [duplicate]

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

No result using makeStyles Material UI in react 18

send email using gmail-api and google-api-php-client

"Mixed content blocked" when running an HTTP AJAX operation in an HTTPS page

getting error while enter Command => php artisan route:list

Laravel Sanctum CSRF not authenticating

Confirm Leave on External Links in Wordpress

PHP: convert all UTF-8 characters to HTML entities

I'm trying to write a clean url for my website using the $_SERVER['REQUEST_URI'] in php

Message: Set sys_temp_dir in your php.ini after installed composer

Update Order custom Field value with WooCommerce REST API

About Contact Privacy policy Terms and conditions