473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

tracking collection modification

I'm working on a remote object system, something kinda like Pyro.
For the purposes of caching I need to be able to tell if a given
dict / list / set has been modified.
Ideally what I'd like is for them to have a modification count
variable that increments every time the particular collection is
modified. Unfortunately I can't find anything like that and since this
needs to work for the regular normal list / dict / set objects
subclassing them to add the modification count isn't useful.
I realize I could take a copy and then compare the copy to the
original, but that's a fairly heavy handed approach and I was hoping
for something light and fast.
Does anyone have any suggestions on best to approach this?
Sep 7 '08 #1
3 987
On Sep 7, 8:54*pm, usenet.tolo...@gmail.com wrote:
I'm working on a remote object system, something kinda like Pyro.
For the purposes of caching I need to be able to tell if a given
dict / list / set has been modified.
Ideally what I'd like is for them to have a modification count
variable that increments every time the particular collection is
modified. Unfortunately I can't find anything like that and since this
needs to work for the regular normal list / dict / set objects
subclassing them to add the modification count isn't useful.
I realize I could take a copy and then compare the copy to the
original, but that's a fairly heavy handed approach and I was hoping
for something light and fast.
Does anyone have any suggestions on best to approach this?
additionally I don't need to know if the things the list (etc)
references have changed, only the list itself
Sep 8 '08 #2
us************@gmail.com wrote:
On Sep 7, 8:54Â*pm, usenet.tolo...@gmail.com wrote:
>I'm working on a remote object system, something kinda like Pyro.
For the purposes of caching I need to be able to tell if a given
dict / list / set has been modified.
Ideally what I'd like is for them to have a modification count
variable that increments every time the particular collection is
modified. Unfortunately I can't find anything like that and since this
needs to work for the regular normal list / dict / set objects
subclassing them to add the modification count isn't useful.
I realize I could take a copy and then compare the copy to the
original, but that's a fairly heavy handed approach and I was hoping
for something light and fast.
Does anyone have any suggestions on best to approach this?

additionally I don't need to know if the things the list (etc)
references have changed, only the list itself
No chance. E.g. ZODB is faced with the same problem and requires you to use
certain collection implementations to make this work.

And don't forget that such a scheme is hard to implement in the face of
concurrent access by various clients - as client connection has to keep
track of the last-modified-state separately.

I'd say that for small to medium-sized collections, it's faster to just
marshal them each time. Beyond that, make the heavy-handed checking - and
offer dirty-state-aware collection classes one can use to optimize specific
cases.

Diez
Sep 8 '08 #3
On 7 Sep, 12:54, usenet.tolo...@gmail.com wrote:
I'm working on a remote object system, something kinda like Pyro.
For the purposes of caching I need to be able to tell if a given
dict / list / set has been modified.
Ideally what I'd like is for them to have a modification count
variable that increments every time the particular collection is
modified. Unfortunately I can't find anything like that and since this
needs to work for the regular normal list / dict / set objects
subclassing them to add the modification count isn't useful.
What you appear to need here is some kind of proxying solution - a
layer which records accesses to the objects, distinct from the objects
themselves. I believe that the PyPy project provides something of this
nature:

http://codespeak.net/pypy/dist/pypy/...e-proxies.html

Paul
Sep 8 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David | last post by:
Hi guys I have in my application many collections (HashTable and ArrayList)loaded with configuration data, that means they are loaded at startup and then they are accessed only for read-only...
5
by: byrocat | last post by:
Sybase and DB2 both have the capability of tracking user activities at a number of levels: invalid access attempts to databases, table, etc.; creation/deletion/modification of database...
7
by: Pete Davis | last post by:
A different question this time. I have a DataGrid bound to a collection. Is there any way for me to allow sorting? The DataGrid.AllowSorting=true doesn't work, but that's probably because it can't...
4
by: Glenn Owens | last post by:
I have a DataGrid web control which I've dynamically populated with template columns to be used for bulk-editting. Generally, all of the columns are textbox and/or dropdownlist child controls. ...
9
by: bonk | last post by:
Does anyone have a simple example on how to prohibit that any thread other than the current thread modifies a certain object (a collection) while we are in a certain section of the code? In other...
2
by: aaronwmail-usenet | last post by:
ANN: SkimpyGimpy PNG canvas has Javascript mouse tracking The SkimpyGimpy PNG image canvas now can generate Javascript data structures which allow HTML pages to intelligently respond to mouse...
22
by: Frank Rizzo | last post by:
I have an object tree that is pretty gigantic and it holds about 100mb of data. When I set the top object to null, I expect that the .NET framework will clean up the memory at some point. ...
0
by: LiveTecs | last post by:
http://www.livetecs.com TimeLive Web Collaboration Suite is an integrated suite that allows you to manage project life cycle including tasks, issues, bugs, timesheet, expense, attendance. ...
2
by: csharpula csharp | last post by:
Hello, I am trying to iterate through list: foreach (classA objectA in listA) { //if there is no objectA with specific name in list A then: listA.add(objectA)
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.