在Google App Engine上实施标记

时间:2022-11-10 23:15:05

I've read the similar question on adding tags to a Django Blog model, where it mentions maintaining tags on the article as a StringList and a separate object to keep a count of these objects, which is good because I'd basically come up with the same idea myself, however I'm struggling to work how how to maintain the count.

我已经阅读了关于向Django Blog模型添加标签的类似问题,其中提到将文章上的标签维护为StringList,并且单独的对象来保持这些对象的计数,这很好,因为我基本上想出来同样的想法我自己,但我正在努力工作如何维持计数。

I'm overriding the put() method of the main object, but how do I check to see if the tags have changed compared to the object currently stored? Is there any way to cheaply check the existing data without fetching a 2nd copy of the object?

我正在覆盖主对象的put()方法,但是如何检查标签是否与当前存储的对象相比发生了变化?有没有办法廉价检查现有数据而无需获取对象的第二个副本?

One way to handle it is to store each object in memcache and only fetch the ones it doesn't find in there, but for a busy site, you're still going to be hitting the datastore quite often.

处理它的一种方法是将每个对象存储在memcache中,只获取它在那里找不到的对象,但是对于繁忙的站点,你仍然会经常访问数据存储区。

1 个解决方案

#1


6  

Check out taggable-mixin. It's a pretty straightforward way to add tags to any AppEngine model class as a mixin.

查看taggable-mixin。将标签作为mixin添加到任何AppEngine模型类是一种非常简单的方法。

#1


6  

Check out taggable-mixin. It's a pretty straightforward way to add tags to any AppEngine model class as a mixin.

查看taggable-mixin。将标签作为mixin添加到任何AppEngine模型类是一种非常简单的方法。