« 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

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.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.

Featured Events

Consolidating Web Apps on the AWS Cloud [Online]

Thursday, May 31
9:00 AM PST
Register Now

AWS Cloud Storage For The Enterprise [New York]

Wednesday, June 6
10:00 AM EST
Register Now

Brought to You By

Jeff Barr (@jeffbarr):



Jinesh Varia (@jinman):



Matt Wood (@mza):



Rodica Buzescu (@AWSstartups):


Email Subscription

Enter your email address:

Delivered by FeedBurner

May 2012

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 31