I've been thinking about ideas to capture more detailed logging info in Django for my app. For instance, I'd like to capture every time someone views a certain object. Also, I might want to capture all items viewed in a session. There are obviously several ways to do it. The simplest is probably to just add the code in a view and do something like: item.viewed += 1 item.save()
My concern is that it may be a lot of db activity. I know that premature optimization can be a bad thing but I'm going to do it anyway ;) So, my thought is to subclass the local mem cache mechanism and modify the _cull behavior so that instead of deleting, it will process the data store all the data in the db. The benefits are: - Speedy updates when objects are viewed. - Spacing out the impact of the costly writes over several minutes Downsides: - It might be more likely that some of the data is lost. However, I'm ok with this since it's aggregate data and the loss of a handful of sessions is no big deal. - I'm trying to optimize something that doesn't really need to be done. - Possibly increased memory usage Has anyone else done anything like this? Am I trying to solve a problem that doesn't really exist? Thanks for the input. -Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---