<<

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, $api_action)

Return the number of requests performed by the given user for the current minute for the given API route. 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 $api_action

The API action that is being requested.

increment_rate_limit_requests ($ip, $api_action)

Increment the number of requests according to the Redis rate-limiter for the current minute for the given user and API route. 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 $api_action

The API action that is being requested.

<<