I am implements a CCursor Cache. Now, I need delete any objects of the cache when the cursor change. I am use Atoms in Client/Server programming. Only something cursor i need retrive always of the database, but other not. When I retrive cursor of the database, I need delete objects of the cache, with this I increment the performance of the aplication.
Victor
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It all depends on how you have implemented your cache...
There are a few things scenarios that you might want to consider:
1. Can one object be cached for multiple cursors? If it can do you have two separate copies of the object or one copy referenced multiple times.
The reason I ask is that two copies introduces problems when an object is updated, and one copy means that if the object is updated it may no longer be a valid member of one of the cursors.
2. When caching the results of a cursor, if a retrievecriteria is reexecuted to refresh the CCursor do you just return the previous results? How do you determine if someone else has created/modified objects that should now be included in the CCursor or is that not relevant?
3. When you talk of deleting are you just clearing the cached results, or do you want to delete objects in the database as well?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. I have only one cursor for type to all application.
2. I am doing a class to control when the database change. If the database change then I refresh the cursor. With this I have update the cursor, but I need delete object from cache.
3. I have delete object only the cache, because if the cursor change y need retrive the las object.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. You are caching retrieveCriteria results (CCursors) since the criterias don't change that often and it boosts performance
2. When you want to refresh the cursor from the database you need to clear the current cached objects (ie the result of the previous retrieval).
3. Each CCursor references only one type of object
4. The cache actually holds objects loaded via the cursors not the CCursors themselves
I would actually restructure things slightly as follows...
Have a collection of caches, one per retrieveCriteria. That way if you need to do a refresh you can simply drop the previous results from the cache collection and add the new results. The garbage collector will take care of the memory clean up and your implementation will be somewhat easier (I think).
Just an idea ;-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But, if I drop the previus result from the cache and add the new results, what happens with the objects in cache, this objects don't the last of the database, because from other pc add a new object or updated one, the objects isn't the last.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi.
I am implements a CCursor Cache. Now, I need delete any objects of the cache when the cursor change. I am use Atoms in Client/Server programming. Only something cursor i need retrive always of the database, but other not. When I retrive cursor of the database, I need delete objects of the cache, with this I increment the performance of the aplication.
Victor
Escuseme, I need delete all object of the cache of the type.
I need move to all cursor and delete object one to one ??
Victor
It all depends on how you have implemented your cache...
There are a few things scenarios that you might want to consider:
1. Can one object be cached for multiple cursors? If it can do you have two separate copies of the object or one copy referenced multiple times.
The reason I ask is that two copies introduces problems when an object is updated, and one copy means that if the object is updated it may no longer be a valid member of one of the cursors.
2. When caching the results of a cursor, if a retrievecriteria is reexecuted to refresh the CCursor do you just return the previous results? How do you determine if someone else has created/modified objects that should now be included in the CCursor or is that not relevant?
3. When you talk of deleting are you just clearing the cached results, or do you want to delete objects in the database as well?
Hi,
1. I have only one cursor for type to all application.
2. I am doing a class to control when the database change. If the database change then I refresh the cursor. With this I have update the cursor, but I need delete object from cache.
3. I have delete object only the cache, because if the cursor change y need retrive the las object.
OK, to make sure I understand...
1. You are caching retrieveCriteria results (CCursors) since the criterias don't change that often and it boosts performance
2. When you want to refresh the cursor from the database you need to clear the current cached objects (ie the result of the previous retrieval).
3. Each CCursor references only one type of object
4. The cache actually holds objects loaded via the cursors not the CCursors themselves
I would actually restructure things slightly as follows...
Have a collection of caches, one per retrieveCriteria. That way if you need to do a refresh you can simply drop the previous results from the cache collection and add the new results. The garbage collector will take care of the memory clean up and your implementation will be somewhat easier (I think).
Just an idea ;-)
hi,
But, if I drop the previus result from the cache and add the new results, what happens with the objects in cache, this objects don't the last of the database, because from other pc add a new object or updated one, the objects isn't the last.