yuzuru-s/redis-ranking 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yuzuru-s/redis-ranking

Composer 安装命令:

composer require yuzuru-s/redis-ranking

包简介

Wrapping Redis's sorted set APIs for specializing ranking operations.

README 文档

README

Coverage Status Build Status Stable Version Download Count License

Abstracting Redis's Sorted Set APIs and PHP to use as a ranking system.

Requirements

Installation

  • Using composer
{
    "require": {
       "yuzuru-s/redis-ranking": "1.0.*"
    }
}
$ php composer.phar update yuzuru-s/redis-ranking --dev

How to use

Please check sample code

<?php
require __DIR__ . '/../vendor/autoload.php';

use YuzuruS\Redis\Ranking;

$redis = new \Redis();
$redis->connect('127.0.0.1', 6379);

$ranking = new Ranking($redis);

$article_ids_of_accessed = [1,1,2,3,4,5,3,4,5,1];


// count up pv of access ids
foreach ($article_ids_of_accessed as $a) {
	$ranking->cntUpPv($a);
}

// make ranking
$ranking->makeAccessRanking(1);

// get ranking
var_dump($ranking->getAccessRanking(1));

/**
array(5) {
[0] =>
string(1) "1"
[1] =>
string(1) "5"
[2] =>
string(1) "4"
[3] =>
string(1) "3"
[4] =>
string(1) "2"
}
 */

How to run unit test

Run with default setting.

% vendor/bin/phpunit -c phpunit.xml.dist

Currently tested with PHP 7.0.0 + Redis 2.6.12.

History

  • 1.0.2
    • Bug fix
  • 1.0.0
    • Published

License

Copyright (c) 2016 YUZURU SUZUKI. See MIT-LICENSE for further details.

Copyright

统计信息

  • 总下载量: 283
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固