Skip to content

Instantly share code, notes, and snippets.

@cilim
Created November 9, 2016 09:27
Show Gist options
  • Save cilim/d94644570e1f0ad26e473b8a88db30fe to your computer and use it in GitHub Desktop.
Save cilim/d94644570e1f0ad26e473b8a88db30fe to your computer and use it in GitHub Desktop.
Stormpath Ruby SDK client initialization with custom caching options for Redis
api_key = Stormpath::ApiKey.new(ENV['test_api_key_id'], ENV['test_api_key_secret'])
client = Stormpath::Client.new(
api_key: api_key,
cache: {
store: Stormpath::Cache::RedisStore,
store_opts: {
host: 'localhost',
port: 7777
},
regions: {
applications: {
ttl_seconds: 120,
tti_seconds: 60
},
directories: {
ttl_seconds: 60,
tti_seconds: 30
},
groups: {
ttl_seconds: 90,
tti_seconds: 45
},
accounts: {
ttl_seconds: 0,
tti_seconds: 0,
store: Stormpath::Cache::DisabledCacheStore
}
}
}
)
client.directories.count # => 3
client.directories.search(name: 'Stormpath Administrators').first.accounts.first.email # => "[email protected]"
@tilo
Copy link

tilo commented Nov 9, 2016

It seems to work fine with localhost, but as soon as I'm trying to set the host or url parameter to something which is not local, it does not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment