<commit_before># Redis PHP Mock [![Build Status](https://secure.travis-ci.org/M6Web/RedisMock.png?branch=master)](http://travis-ci.org/M6Web/RedisMock)

PHP 5.3 library providing a Redis PHP mock for your tests.  

## Installation

Add this line in your `composer.json` :

```json
{
    "require": {
        "m6web/redis-mock": "~1.2"
    }
}
```

Update your vendors :

```
$ composer update m6web/redis-mock
```

## Functions

It currently mocks these Redis functions :

Redis function                                   | Description
-------------------------------------------------|------------
**SET** *key* *value*                            | Sets the string value of a key
**GET** *key*                                    | Gets the value of a key
**INCR** *key*                                   | Increments the integer value of a key by one
**DEL** *key*                                    | Deletes a key
**EXISTS** *key*                                 | Determines if a key exists
**KEYS** *pattern*                               | Finds all keys matching the given pattern
**TYPE** *key*                                   | Returns the string representation of the type of the value stored at key.
**SADD** *key* *member*                          | Adds one member to a set
**SISMEMBER** *key* *member*                    | Determines if a member is in a set
**SMEMBERS** *key*                               | Gets all the members in a set
**SREM** *key* *member*                          | Removes one member from a set
**HEXISTS** *key* *field*                        | Determines if a hash field exists
**HGET** *key* *field*                           | Gets the value of a hash field
**HGETALL** *key*                                | Gets all the fields and values in a hash
**HSET** *key* *field* *value*                   | Sets the string value of a hash field
**ZADD** *key* *score* *member*                  | Adds one member to a sorted set, or update its score if it already exists
**ZRANGE** *key* *start* *stop*                  | Returns the specified range of members in a sorted set
**ZRANGEBYSCORE** *key* *min* *max* *options*    | Returns a range of members in a sorted set, by score
**ZREM** *key* *member*                          | Removes one membner from a sorted set
**ZREMRANGEBYSCORE** *key* *min* *max*           | Removes all members in a sorted set within the given scores
**ZREVRANGE** *key* *start* *stop*               | Returns the specified range of members in a sorted set, with scores ordered from high to low
**ZREVRANGEBYSCORE** *key* *min* *max* *options* | Returns a range of members in a sorted set, by score, with scores ordered from high to low
**FLUSHDB**                                      | Flushes the database

It also mocks **PIPELINE** and **EXECUTE** functions but without any transaction behaviors, they just make the interface fluent.

## Usage<commit_msg>ttl and expire in the readme<commit_after># Redis PHP Mock [![Build Status](https://secure.travis-ci.org/M6Web/RedisMock.png?branch=master)](http://travis-ci.org/M6Web/RedisMock)

PHP 5.3 library providing a Redis PHP mock for your tests.  

## Installation

Add this line in your `composer.json` :

```json
{
    "require": {
        "m6web/redis-mock": "~1.2"
    }
}
```

Update your vendors :

```
$ composer update m6web/redis-mock
```

## Functions

It currently mocks these Redis functions :

Redis function                                   | Description
-------------------------------------------------|------------
**SET** *key* *value*                            | Sets the string value of a key
**GET** *key*                                    | Gets the value of a key
**INCR** *key*                                   | Increments the integer value of a key by one
**DEL** *key*                                    | Deletes a key
**TTL** *key*                                    | Get the time to live for a key
**EXISTS** *key*                                 | Determines if a key exists
**EXPIRE** *key* *seconds*                       | Set a key's time to live in seconds
**KEYS** *pattern*                               | Finds all keys matching the given pattern
**TYPE** *key*                                   | Returns the string representation of the type of the value stored at key.
**SADD** *key* *member*                          | Adds one member to a set
**SISMEMBER** *key* *member*                    | Determines if a member is in a set
**SMEMBERS** *key*                               | Gets all the members in a set
**SREM** *key* *member*                          | Removes one member from a set
**HEXISTS** *key* *field*                        | Determines if a hash field exists
**HGET** *key* *field*                           | Gets the value of a hash field
**HGETALL** *key*                                | Gets all the fields and values in a hash
**HSET** *key* *field* *value*                   | Sets the string value of a hash field
**ZADD** *key* *score* *member*                  | Adds one member to a sorted set, or update its score if it already exists
**ZRANGE** *key* *start* *stop*                  | Returns the specified range of members in a sorted set
**ZRANGEBYSCORE** *key* *min* *max* *options*    | Returns a range of members in a sorted set, by score
**ZREM** *key* *member*                          | Removes one membner from a sorted set
**ZREMRANGEBYSCORE** *key* *min* *max*           | Removes all members in a sorted set within the given scores
**ZREVRANGE** *key* *start* *stop*               | Returns the specified range of members in a sorted set, with scores ordered from high to low
**ZREVRANGEBYSCORE** *key* *min* *max* *options* | Returns a range of members in a sorted set, by score, with scores ordered from high to low
**FLUSHDB**                                      | Flushes the database

It also mocks **PIPELINE** and **EXECUTE** functions but without any transaction behaviors, they just make the interface fluent.

## Usage
{'fraction_non_alphanumeric': 0.12201986754966887, 'fraction_numerical': 0.0026490066225165563, 'mean_word_length': 1.731012658227848, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 23, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2667261', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1586, 'n_words': 685}