Created
November 9, 2016 09:27
-
-
Save cilim/d94644570e1f0ad26e473b8a88db30fe to your computer and use it in GitHub Desktop.
Stormpath Ruby SDK client initialization with custom caching options for Redis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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