aws-dev-utils 1.4.7 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +55 -56
- data/lib/aws-dev-utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 133632b0672e9313460c49b69dab68ac465e4d7c47d91c8e5021b7f5b02c4353
|
4
|
+
data.tar.gz: '068989b426924ff1094320269d146e69e135b2bb28a23fa35d767b938aa6c880'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5fe09acdea5374f0e79251af18fc26888d5647e8ba13e316389d7aac833ad2c25649aca123f7416cfca2ed4fefd99d5a4c7bdc170aee7b6453c2b371cf3db2a
|
7
|
+
data.tar.gz: a8d471e5bc6acbf991bd1794ed286a08ccc401e35ab9eef57ba336669bf7e026b28529fc327a8058abe6528d77d72e30ad95328c77733c2e0288d055029b0df7
|
data/README.md
CHANGED
@@ -62,62 +62,61 @@ AwsDevUtils::Cache.instance.backend = AwsDevUtils::Backend::Redis.new("redis-url
|
|
62
62
|
|
63
63
|
_Note: Data will be restored from the cache only if it is the same request to AWS client, the same filters and the same expiration time ._
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
```
|
65
|
+
```ruby
|
66
|
+
# Memory Caching.
|
67
|
+
require 'aws-dev-utils'
|
68
|
+
using AwsDevUtils::Refinements
|
69
|
+
|
70
|
+
ec2_client = Aws::EC2::Client.new
|
71
|
+
ec2_client.
|
72
|
+
with_cache.
|
73
|
+
describe_instances(filters:[{ name: "vpc-id", values: ["vpc-foo"]}])
|
74
|
+
```
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
# Redis based caching with default experiation time (60 seconds).
|
78
|
+
require 'aws-dev-utils'
|
79
|
+
using AwsDevUtils::Refinements
|
80
|
+
|
81
|
+
AwsDevUtils::Cache.instance.backend = AwsDevUtils::Backend::Redis.new("redis-url")
|
82
|
+
ec2_client.
|
83
|
+
with_cache.
|
84
|
+
describe_instances(filters:[{ name: "vpc-id", values: ["vpc-foo"]}])
|
85
|
+
```
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
# Redis based caching with custom expiration time (10 minutes).
|
89
|
+
require 'aws-dev-utils'
|
90
|
+
using AwsDevUtils::Refinements
|
91
|
+
|
92
|
+
AwsDevUtils::Cache.instance.backend = AwsDevUtils::Backend::Redis.new("redis-url")
|
93
|
+
ec2_client.
|
94
|
+
with_cache(600).
|
95
|
+
describe_instances(filters:[{ name: "vpc-id", values: ["vpc-foo"]}])
|
96
|
+
```
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
# Example of different cache keys from requests.
|
100
|
+
require 'aws-dev-utils'
|
101
|
+
using AwsDevUtils::Refinements
|
102
|
+
|
103
|
+
AwsDevUtils::Cache.instance.backend = AwsDevUtils::Backend::Redis.new("redis-url")
|
104
|
+
|
105
|
+
# No cache data so request goes to AWS servers.
|
106
|
+
foo_1_instances = ec2_client.
|
107
|
+
with_cache(600).
|
108
|
+
describe_instances(filters:[{ name: "vpc-id", values: ["vpc-foo"]}])
|
109
|
+
|
110
|
+
# Different filters than foo_1_instances so request goes to AWS servers.
|
111
|
+
bar_1_instances = ec2_client.
|
112
|
+
with_cache(600).
|
113
|
+
describe_instances(filters:[{ name: "vpc-id", values: ["vpc-bar"]}])
|
114
|
+
|
115
|
+
# Same filters as bar_1_instances, so result is fetched from cache.
|
116
|
+
bar_2_instances = ec2_client.
|
117
|
+
with_cache(600).
|
118
|
+
describe_instances(filters:[{ name: "vpc-id", values: ["vpc-bar"]}])
|
119
|
+
```
|
121
120
|
|
122
121
|
### with_retry
|
123
122
|
By using the `client.with_retry`, the client functions will be retried in case of an exception (until the max number of retries is reached - the default is 5).
|