All Projects → palicao → phpRebloom

palicao / phpRebloom

Licence: MIT license
🎛️ Use RedisBloom in PHP!

Programming Languages

PHP
23972 projects - #3 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to phpRebloom

phpRedisTimeSeries
📈 Use Redis Time Series in PHP!
Stars: ✭ 23 (+15%)
Mutual labels:  redis-server, driver, predis
guava-probably
Probabilistic data structures for Guava.
Stars: ✭ 51 (+155%)
Mutual labels:  bloom-filter, cuckoo-filter
cuckoo filter
High-performance, concurrent, and mutable Cuckoo Filter for Erlang and Elixir
Stars: ✭ 31 (+55%)
Mutual labels:  bloom-filter, cuckoo-filter
Phpfastcache
A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.
Stars: ✭ 2,171 (+10755%)
Mutual labels:  driver, predis
readis
Lightweight web frontend in PHP for reading data, stats and config from multiple redis servers.
Stars: ✭ 38 (+90%)
Mutual labels:  redis-server
redi-s
A performant Redis server implemented in SwiftNIO.
Stars: ✭ 69 (+245%)
Mutual labels:  redis-server
rediserver
Pure Python Redis server implementation
Stars: ✭ 26 (+30%)
Mutual labels:  redis-server
MsCoreOne
MsCoreOne is a simple Ecommerce with using many technologies such as .NET 5, Entity Framework Core 5, React 16.13 with modern Clean Architecture, Domain-Driven Design, CQRS, SOLID, Identity Server 4, Blazor. It will focus on resolving the problems always see in the process to develop projects.
Stars: ✭ 77 (+285%)
Mutual labels:  redis-server
raptor
A fast and space-efficient pre-filter for querying very large collections of nucleotide sequences.
Stars: ✭ 37 (+85%)
Mutual labels:  bloom-filter
redface
RedFace means redis interface.
Stars: ✭ 23 (+15%)
Mutual labels:  redis-server
hanbo-db
hanboDB is a high available,low latency memory database system
Stars: ✭ 29 (+45%)
Mutual labels:  redis-server
The-Overly-Complicated-Random-Number-Generator
An Overly Complex Random Number Generator, created to demystify how containers work.
Stars: ✭ 25 (+25%)
Mutual labels:  redis-server
CRDT-Redis
CRDTs implemented in Redis
Stars: ✭ 35 (+75%)
Mutual labels:  redis-server
centminmod-magento2
Magento 2.2.2 Install Guide For Centmin Mod Nginx LEMP Stacks
Stars: ✭ 16 (-20%)
Mutual labels:  redis-server
redis
Redis server written in Go / Golang (prototype)
Stars: ✭ 53 (+165%)
Mutual labels:  redis-server
redis-patterns-console
An interactive (and reactive) console to try and go into the deep of Redis and its patterns!
Stars: ✭ 22 (+10%)
Mutual labels:  redis-server
terraform-aws-elasticache
Terraform module to create Elasticache Cluster and replica for Redis and Memcache.
Stars: ✭ 19 (-5%)
Mutual labels:  redis-server
cachegrand
cachegrand is an open-source fast, scalable and secure Key-Value store, also fully compatible with Redis protocol, designed from the ground up to take advantage of modern hardware vertical scalability, able to provide better performance and a larger cache at lower cost, without losing focus on distributed systems.
Stars: ✭ 87 (+335%)
Mutual labels:  redis-server
rancher-redis
A containerized redis master/slave configuration with sentinels for use in Rancher
Stars: ✭ 13 (-35%)
Mutual labels:  redis-server
redis-developer.github.io
The Home of Redis Developers
Stars: ✭ 28 (+40%)
Mutual labels:  redis-server

PhpRebloom

Use Redis Bloom with PHP!

Code Climate maintainability Code Climate coverage Build Status Latest Stable Version PHP version GitHub

Disclaimer: this is a very lightweight library. For a battery-included experience, please checkout: https://github.com/averias/phpredis-bloom

Install

composer require palicao/php-rebloom

Bloom Filter

A Bloom filter is a space-efficient probabilistic data structure designed to determine whether an element is present in a set. False positives are possible.

$bloomFilter = new BloomFilter(
    new RedisClient(
        new Redis(),
        new RedisConnectionParams($host, $port)
    )
);

reserve

BloomFilter::reserve(string $key, float $error, int $capacity): bool

Creates an empty Bloom Filter with a given desired error ratio and initial capacity.

See https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfreserve.

insert

BloomFilter::insert(string $key, string $value, ?float $error = null, ?int $capacity = null): bool

Adds an item to the Bloom Filter, creating the filter if it does not yet exist.

See https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfadd and https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfinsert.

insertMany

BloomFilter::insertMany(string $key, array $values, ?float $error = null, ?int $capacity = null): bool[]

Adds several items to the BloomFilter, creating the filter if it does not yet exist.

See https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfmadd and https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfinsert.

insertIfKeyExists

BloomFilter::insertIfKeyExists(string $key, string $value): bool

Adds an item to the Bloom Filter, only if the filter already exists.

See https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfadd and https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfinsert.

insertManyIfKeyExists

BloomFilter::insertManyIfKeyExists(string $key, array $values): bool[]

Adds several items to the Bloom Filter, only if the filter already exists.

See https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfadd and https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfinsert.

exists

BloomFilter::exists(string $key, string $value): bool

Checks if an item exists.

See https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfadd.

manyExist

BloomFilter::manyExist(string $key, array $values): bool[]

Checks if many items exist.

See https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfmexists.

scanDump, loadChunks and copy

BloomFilter::scanDump(string $key): array BloomFilter::loadChunks(string $key, array $chunks): void BloomFilter::copy(string $sourceKey, string $destKey): void

scanDump exports the whole Bloom Filter in an array, which can be loaded in chunks by loadChunks. The copy function, using the previous 2 functions, allows to quickly copy one Bloom Filter to a different key.

See https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfscandump and https://oss.redislabs.com/redisbloom/Bloom_Commands/#bfloadchunk.

Cuckoo Filter

Cuckoo filter is similar to Bloom Filter, but it's even more space-efficient and allows deleting items.

$cuckooFilter = new CuckooFilter(
    new RedisClient(
        new Redis(),
        new RedisConnectionParams($host, $port)
    )
);

reserve

CuckooFilter::reserve(string $key, int $capacity, ?int $bucketSize = null, ?int $maxIterations = null, ?int $expansion = null): bool

Create an empty cuckoo filter with an initial capacity. The false positive rate is fixed at about 3%, depending on how full the filter is.

See https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfreserve.

insert

CuckooFilter::insert(string $key, string $value, bool $allowDuplicateValues = true, ?int $capacity = null): bool

Adds an item to the cuckoo filter, creating the filter if it does not exist.

See https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfadd, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfaddnx, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfinsert, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfinsertnx.

insertMany

CuckooFilter::insertMany(string $key, array $values, bool $allowDuplicateValues = true, ?int $capacity = null): bool[]

Similar to the previous, adds many values to the key.

See https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfadd, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfaddnx, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfinsert, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfinsertnx.

insertIfKeyExists

CuckooFilter::insertIfKeyExists(string $key, string $value, bool $allowDuplicateValues = true, ?int $capacity = null): bool

Inserts an item in a cuckoo filter, only if it exists.

See https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfadd, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfaddnx, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfinsert, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfinsertnx.

insertManyIfKeyExists

CuckooFilter::insertManyIfKeyExists(string $key, array $values, bool $allowDuplicateValues = true, ?int $capacity = null): bool[]

Inserts many items in a cuckoo filter, only if it exists.

See https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfadd, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfaddnx, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfinsert, https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfinsertnx.

exists

CuckooFilter::exists(string $key, string $value): bool

Returns true if a cuckoo filter exists.

See https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfexists.

delete

CuckooFilter::delete(string $key, string $value): bool

Deletes an item once in a filter.

See https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfdel.

count

CuckooFilter::count(string $key, string $value): int

Returns the number of times an item may be in the filter.

See https://oss.redislabs.com/redisbloom/Cuckoo_Commands/#cfcount.

scanDump, loadChunks and copy

CuckooFilter::scanDump(string $key): array CuckooFilter::loadChunks(string $key, array $chunks): void CuckooFilter::copy(string $sourceKey, string $destKey): void

scanDump exports the whole Cuckoo Filter in an array, which can be loaded in chunks by loadChunks. The copy function, using the previous 2 functions, allows to quickly copy one Cuckoo Filter to a different key.

CountMinSketch

Count-Min Sketch is a probabilistic data structure that serves as a frequency table of events in a stream of data.

$countMinSketch = new CountMinSketch(
    new RedisClient(
        new Redis(),
        new RedisConnectionParams($host, $port)
    )
);

initByDimensions

CountMinSketch::initByDimensions(string $key, int $width, int $depth): bool

Initializes a CountMinSketch named $key with the $width and $depth provided by the user.

See https://oss.redislabs.com/redisbloom/CountMinSketch_Commands/#cmsinitbydim.

initByProbability

CountMinSketch::initByProbability(string $key, float $error, float $probability): bool

Initializes a CountMinSketch to accommodate the desired error rate and probability for inflated count.

See https://oss.redislabs.com/redisbloom/CountMinSketch_Commands/#cmsinitbyprob.

incrementBy

CountMinSketch::incrementBy(string $key, Pair ...$pairs): bool

Increments one or more items by a given value in a CountMinSketch. A Pair represents an item and the value we want to increment.

See https://oss.redislabs.com/redisbloom/CountMinSketch_Commands/#cmsincrby.

query

CountMinSketch::query(string $key, string ... $items): Pair[]

Returns the approximate count for one or more items.

See https://oss.redislabs.com/redisbloom/CountMinSketch_Commands/#cmsquery.

merge

Merges multiple CountMinSketches into one, so that the value for each item is the sum of the values in each sketch. The $sourceKeysWeightMap is an associative array where each key is a sketch, and the value is the weight, that is the value we want each item count to be multiplied by before merging.

CountMinSketch::merge(string $destinationKey, array $sourceKeysWeightMap) : bool

See https://oss.redislabs.com/redisbloom/CountMinSketch_Commands/#cmsmerge.

info

Returns an instance of CountMinSketchInfo, which contains information regarding width, depth and total count of the sketch.

CountMinSketch::info(string $key): CountMinSketchInfo

See https://oss.redislabs.com/redisbloom/CountMinSketch_Commands/#cmsinfo.

TopK

Similar to CountMinSketch, is based on the algorithm described here: https://www.usenix.org/conference/atc18/presentation/gong

reserve

TopK::reserve(string $key, int $topK, int $width, int $depth, float $decay): bool

Reserves a TopK suitable to calculate $topK top elements, with a given $width and $depth and with a specified $decay (probability of reducing a counter in an occupied bucket).

See https://oss.redislabs.com/redisbloom/TopK_Commands/#topkreserve.

add

Adds one or more item to the TooK. If an item enters the Top-K list, the item which is expelled is returned in the position that was occupied by the added item that took its place in the Top-K.

TopK::add(string $key, string ... $items): array

See https://oss.redislabs.com/redisbloom/TopK_Commands/#topkadd.

incrementBy

Increase the score of an item in the data structure by increment. Similar to add, expelled items are returned.

TopK::incrementBy(string $key, Pair ...$pairs): array

See https://oss.redislabs.com/redisbloom/TopK_Commands/#topkincrby.

query

Returns subset of $items containing the elements found in the Top-K.

TopK::query(string $key, string ... $items): string[]

See https://oss.redislabs.com/redisbloom/TopK_Commands/#topkquery.

count

Returns a subset of $items containing the elements found in the top-k with their approximate count.

TopK::count(string $key, string ... $items): Pair[]

See https://oss.redislabs.com/redisbloom/TopK_Commands/#topkcount.

list

Returns the top-k items with their relative position.

TopK::list(string $key): Pair[]

See https://oss.redislabs.com/redisbloom/TopK_Commands/#topklist.

info

Returns a TopKInfo object containing information about size, with, depth and decay of the Top-K

TopK::info(string $key): TopKInfo

See https://oss.redislabs.com/redisbloom/TopK_Commands/#topkinfo.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].