<<

NAME

ProductOpener::Redis - functions to push information to redis

DESCRIPTION

ProductOpener::Redis is handling pushing info to Redis to communicate updates to all services, including search-a-licious.

$redis_client

The connection to redis

init_redis($is_reconnect=0)

init $redis_client or re-init it if we where disconnected

it is uses ProductOpener::Config2::redis_url

push_to_redis_stream ($user_id, $product_ref, $action, $comment, $diffs)

Add an event to Redis stream to inform that a product was updated.

Arguments

String $user_id

The user that updated the product.

Product Object $product_ref

The product that was updated.

String $action

The action that was performed on the product (either "updated" or "deleted"). A product creation is considered as an update.

String $comment

The user comment associated with the update.

HashRef $diffs

a hashref of the differences between the previous and new revision of the product.

get_rate_limit_user_requests ($ip, $bucket)

Return the number of requests performed by the given user for the current minute for the given rate-limit bucket. See https://redis.com/glossary/rate-limiting/ for more information.

If the rate-limiter is not configured or if an error occurs, returns undef.

Arguments

String $ip

The IP address of the user who is making the request.

String $bucket

The rate-limit bucket that is being requested.

increment_rate_limit_requests ($ip, $bucket)

Increment the number of requests according to the Redis rate-limiter for the current minute for the given user and bucket. The expiration of the counter is set to 59 seconds. See https://redis.com/glossary/rate-limiting/ for more information.

Arguments

String $ip

The IP address of the user who is making the request.

String $bucket

The rate-limit bucket that is being requested.

<<