Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is CacheItem Iterator working as expected? #39

Open
cflewis opened this issue Jun 17, 2011 · 1 comment
Open

Is CacheItem Iterator working as expected? #39

cflewis opened this issue Jun 17, 2011 · 1 comment
Assignees

Comments

@cflewis
Copy link

cflewis commented Jun 17, 2011

In Cache.java, there's this bit of code:

// used in file distribution output
@Override
public Iterator<CacheItem> iterator() {
    return cacheTable.values().iterator();
}

This will return the contents of cacheTable, but my understanding is that the contents of cacheTable does not necessarily reflect the contents of the cache. Shouldn't the items be checked for isInCache before they are returned?

If not, is this iterator safe to use if I want to output the contents of the cache at the end of the simulation?

@ghost ghost assigned supertri Jun 17, 2011
@xyzhu
Copy link
Member

xyzhu commented Jun 21, 2011

I think this should be checked. Because when we remove an item from
cache, we do not really remove it, instead we just set its "inCache"
to be false. So at last, only cache items with inCache being true
reflect the content of the cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants