• 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

Target Laravelista is not instantiable

How to use React Router with Laravel?

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

how to insert data into select2 search input after scan using qrcode

Woocommerce redirect after add-to-cart error

500 Internal Server Error on Ajax request. Not sure the origin of the problem

Is there a way to correctly use sanitize_text_field and wp_unslash that doesn't cause psalm to error with "expects string, possibly different type"

Image upload not working through ajax Laravel

What is PHP's equivalent of JavaScript's "array.every()"?

Form repeater send wrong data with last element in Laravel

Whats the point of running Laravel with the command 'php artisan serve'?

Check If array is null or not in php

Live search query using JS and PHP for QA forum

array_key_exists(): The first argument should be either a string or an integer

How to Display Data in Yajra Datatables Laravel 7?

About Contact Privacy policy Terms and conditions