AUTHOR: http://aws.typepad.com/aws/2012/01/how-collections-work-in-the-aws-sdk-for-ruby.html LINK!

Recent AWS Customer Success Stories & Videos

More AWS Customer Success Stories...

« Help Wanted - Manager and Senior Developers for new AWS Media Product | Main | EC2 Instance Status Checks and Reporting »

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c534853ef0162fdcecbed970d

Listed below are links to weblogs that reference How Collections Work in the AWS SDK for Ruby:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Jay Feldblum

People who use ActiveRecord or Mongoid will already be familiar with this behavior. But they will know this behavior under the name "IdentityMap". They already know that recent versions of ActiveRecord and Mongoid always re-fetch the entity from the backing store/service, unless you have the identity-map setting enabled causing both libraries to check the identity-map before fetching entities from the remote store/service.

"Identity Map" seems like a better word than "Memoize" in this context.

* http://martinfowler.com/eaaCatalog/identityMap.html
* http://en.wikipedia.org/wiki/Identity_map

The #with_identity_map method (a renamed #memoize method) should also be a method on each collection instance:

ec2.images.with_identity_map {|images| images.map(&:description) }

When called as AWS.with_identity_map, all fetches to any AWS service within the block should be preceded by a cache check. When called as ec2.images.with_identity_map, only fetches to the AWS Images service within the block should be preceded by a cache check.

Finally, there should be non-block versions. AWS.enable_identity_map!, AWS.disable_identity_map!, ec2.images.enable_identity_map!, and ec2.images.disable_identity_map!.

Matty Noble

Thanks for the feedback! It does sound like "identity map" is a similar concept, however I feel that there might be some subtle but important differences between what identity mapping means for ActiveRecord and what AWS.memoize means for the Ruby SDK. We'll have to think about that one a bit more.

It sounds like you are also interested in being able to scope memoize (or identity mapping) to a single service or to a single type of resource. This sounds like a good feature, and I'd love to hear more about how and when you would use it.

Finally, you mentioned that you would like to start and stop memoizing without a block. This feature exists today in the SDK, and is documented here:

http://docs.amazonwebservices.com/AWSRubySDK/latest/AWS.html#start_memoizing-class_method

AWS.memoize is implemented using AWS.start_memoizing and AWS.stop_memoizing.

The comments to this entry are closed.

Featured Events

The AWS Report


Brought to You By

Jeff Barr (@jeffbarr):



Jinesh Varia (@jinman):


Email Subscription

Enter your email address:

Delivered by FeedBurner

April 2014

Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30