Rate Limit Cache Try it

A useful optimization to the rate limit clients is the ability to cache when a token bucket has been exhausted.

All responses from the API that are 'unsuccessful' in acquiring a token return an 'expiry' which is equal to the next possible time that the token bucket will be filled.

Configuring Your Cache

#config/prefab.rb
$prefab = Prefab::Client.new(shared_cache: Rails.cache)
net.spy.memcached.MemcachedClient memcachedClient = new net.spy.memcached.MemcachedClient(
        new InetSocketAddress("localhost", 11211));

PrefabCloudClient.Builder builder = new PrefabCloudClient.Builder()
    .setDistributedCache(new MemcachedCache(memcachedClient))

final PrefabCloudClient prefabCloudClient = new PrefabCloudClient(builder);
final RateLimitClient rateLimitClient = prefabCloudClient.rateLimitClient();
Try it