Google App Engine / Objectify Soft Delete

I use Objectify for my DAO layer in GAE, I want to make most of my entity soft-delete-able, it is a good idea that these entities extend the parent element with isActive boolean or should I use the built-in or should I just make it an interface isSoftDeleteable?

The reason I'm asking is because it seems that Objectify is saving Entity with the same parent class in the same Entity type (at least from what I see in _ah / admin), and this can slow down a request, when everything is under the same kind of entity, maybe?

What is the best way or is there a better way to do soft-delete in GAE?

Please let us know in advance!

+3
source share
2 answers

There is no single correct answer to this question. The optimal solution mainly depends on what percentage of your objects is likely to be in a remote state at any given time.

One option is to save the type field @Index(IfTrue.class) boolean active;and add this filter to all queries:

ofy.load().type(Thing.class).filter("size >", 20).filter("active", true)

The disadvantage of this is that it requires the addition of additional indexes - perhaps several, because now you may need indexes with several properties, in which indexes of one property are enough.

"deleted" . , , . , .

. , , , , : @Index Date deleted; filter("deleted", null) , datestamp, , , , . , , , , , . @Index(IfNull.class) Date deleted; map-reduce .

+5

StickFigure. "" "" . , - , , 2 ( ), , . , 2 . , .

, , , , , , get .

+1

All Articles