Changes between Version 2 and Version 3 of DjangoSpecifications/Core/SingleInstance
- Timestamp:
- Mar 23, 2008, 1:12:50 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DjangoSpecifications/Core/SingleInstance
v2 v3 10 10 11 11 == Proposals == 12 The basic idea of #17 is to simply reuse existing instances. This works by keeping track of instan ciated objects on a per model basis. Whenever we try to instanciate a model, we check if there is already an instance in memory and reuse it if so. This would solve both issues mentionned above. Please note that the proposal is absolutely NOT a caching system. Whenever an instance goes out of scope it is still discarded.12 The basic idea of #17 is to simply reuse existing instances. This works by keeping track of instantiated objects on a per model basis. Whenever we try to instantiate a model, we check if there is already an instance in memory and reuse it if so. This would solve both issues mentioned above. Please note that the proposal is absolutely NOT a caching system. Whenever an instance goes out of scope it is still discarded. Also, it would most likely be turned off by default, and only work for Models which have this feature explicitly enabled. 13 13 14 14 To understand the benefits of the proposed patch, let's see a small example: