1
votes

Does anyone have a good example of a sharded counter entity and how to use it in Objectify? The examples I have seen so far are in the native Java datastore api.

For example, suppose you want to keep a counter of how many views a specific page Entity gets (and there can be many page entities).

Just don't want to shoot myself in the foot =P

1
Are you asking specifically for Objectify because you need a specific behaviour? Why datastore API cannot be used? - Deviling Master
@DevilingMaster I am using objectify with cloud endpoints so I don't want to use the native datastore api in there too - would be too messy. - Micro
This link cloud.google.com/appengine/articles/sharding_counters has examples for JDO as well, which would be pretty straight-forward to adapt to Objectify - Brett
@COBB Yeah I saw that but was hoping someone already had gist or something they have debugged and verfied - Micro

1 Answers

2
votes

This library is an Objectify implementation of a Sharded Counter engine

https://github.com/instacount/appengine-counter