Skip to content

tile json not caching #5

@jamiechong

Description

@jamiechong

As far as I can tell, the JSON tile files aren't being cached. You have

        if ((typeof jsonCache[cellx] !== 'undefined') &&
            (typeof jsonCache[cellx][celly] !== 'undefined') &&
            (typeof jsonCache[cellx][celly][zoom] !== 'undefined'))
        {
            // Cache hit
            console.log('cache hit');
            handleJson (x, y, jsonCache[cellx][celly][zoom], callback);
            return;
        }

But I don't see this getting set with a successfully loaded json file anywhere in the source. The closes it gets is this:

                handleJson (x, y, json[zoom], callback);
                if (typeof jsonCache[cellx] === 'undefined') {
                    jsonCache[cellx] = {};
                }
                jsonCache[cellx][celly] = json;

This is perhaps where the bug is - maybe it needs to be

                handleJson (x, y, json[zoom], callback);
                if (typeof jsonCache[cellx] === 'undefined') {
                    jsonCache[cellx] = {};
                }
                if (typeof jsonCache[cellx][celly] === 'undefined') {
                    jsonCache[cellx][celly] = {};
                }
                jsonCache[cellx][celly][zoom] = json;

I can't tell if this is intentional or not. Would be great if you could review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions