ganglio/pds
Composer 安装命令:
composer require ganglio/pds
包简介
Probabilistic Data Structures to efficiently analyze and mine big datasets
关键字:
README 文档
README
Probabilistic Data Structures to efficiently analyze and mine big datasets
This package contains a collection of data structures and tools to analyze big amounts of data in a memory efficient way.
Table Of Content
Installation
Install via Composer (make sure you have composer in your path or in your project).
Put the following in your package.json:
{
"require": {
"ganglio/PDS": "*"
}
}
and then run composer install or just run
composer require ganglio/PDS
Namespaces
A number of namespaces are defined in the library.
- \ganglio\PDS\Bloom
- \ganglio\PDS\Estimators
- \ganglio\PDS\Hash
- \ganglio\PDS\Storage
Interfaces
Estimator
This interface is the basis for cardinality estimators. It defines two methods:
add($key)- adds a key to the estimatorcount()- returns the number of keys added to the estimator
Depending on the implementation the actual class might return an exact estimation, like the Exact class, or an approximation like the HyperLogLog class.
Hash
This interface is the basis for the various hashing classes offered by the package. It defines one method and a constant:
hash($str)- performs the actual hashing of the string providedUPPERBOUND- a 32-bit mask to be used by the hashing functions0xffffffff
Storage
This interface is the basis for the storage classes. It defines four methods:
set($key, $value)- sets a value to the key in the storage systemget($key)- gets the value stored to the keyflush()- flushes the storage systemsize()- returns the number of keys stored in the storage system
Classes
BitArray (implements Storage)
Implements a single bit array. It's used to implement the Bloob Filter where the set method only accepts Bool as $value.
HyperLogLog (implements Estimator)
Implements the HyperLogLog cardinality estimator algorithm. The actual implementation uses HyperLogLog for big cardinalities and LinearCounting for small ones as it gives a better approximation.
Exact (implements Estimator)
Implement an exact counter. It's primarily a toy class to show how to use the Estimator interface.
Trivial (implements Hash)
Implements a trivial hashing algorithm. Basically adds the ASCII code shifted right by the character position for each characted of the input string and then takes the lower 32 bits. It's a toy class to show how to use the Hash interface.
Pearson (implements Hash)
Implements the Pearson non-cryptographic hashing function.
FVNHash (implements Hash)
Implements the Fowler-Noll-Vo non-cryptographic hashing function. The actual algorithm is the FNV-1 hash.
Generic (implements Hash)
This class is basically a wrapper around the standard PHP hash function. The constructor accepts the algorithm name to use as from the PHP hash_algos() function. If an unknown algorithm is specified it raises an exception, if none is specified MD5 is selected as default.
MultiHash (implements Hash)
This class calculates multiple hashes using different algorithms specified ad arguments of the constructor. It's primarily used in conjunction with the BitArray class to implement the Bloom Filter.
Bloom
This class implements a Bloom Filter, a probabilistic data structure that allows to test if an element is a member of a set with a very small memory footprint.
Examples
TODO
ganglio/pds 适用场景与选型建议
ganglio/pds 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 09 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「filter」 「data structures」 「Bloom Filter」 「hashes」 「unique」 「hyperloglog」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ganglio/pds 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ganglio/pds 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ganglio/pds 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
Structure-aware migration helpers for Laravel Enso packages
Nova searchable filter for belongsTo relationships.
A collection of functional programming data structures
Adds the EDTF data type to Wikibase
A simple library that allows transform any kind of data to native php data or whatever
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-15