-
Notifications
You must be signed in to change notification settings - Fork 68
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
New version of L.TileLayer.PouchDBCached.js #36
Comments
Hi @rwillett, I know it's been long, is the code still available?? I'd like to have a look =) |
It is available, but it's been so long since I last looked at it and the comments above, I cannot remember what I did :) I've read what I wrote above and would need to look at the code to work it out again. Old age is setting in. |
Ok, no worries, if you encounter some limitation to do that, let me know and I could look at the code and try to understand the changes (if you don't mind) =) Thanks! |
I'm happy to send it, I just can't remember what I did and why :) Let me have a look at it again so I can try and refresh my memory. |
Hi,
I've taken this file and rewritten it so that it doesn't use PouchDB at all but uses a simple synchronous in memory storage system.
The reason for this is that I use HERE maps with the traffic tiles and any tile over two mins old is out of date anyway, but I wanted the caching facility to reduce network usage and to speed things up. So there was no need to cache things long term (more than two mins), no need to sync data and PouchDB is complete overkill for my needs.
The core of the code is basically the same as before so I cannot take much (any?) credit for this. I have simply removed the PouchDB requirements and substituted my own calls to my own SimpleDB prototype. The API has stayed the same, e.g. so the call to
is still the same call but now it calls my versions of the code for db.remove and db.put and not PouchDB. All I have done is mimic the PouchDB API calls to get, put and remove to my own calls which use a simple array to store the data. It still uses callbacks but not bothered with promises as this code doesn't use them :)
A couple of updates we have made is that we modify the URL called. We strip out the subdomain that HERE maps uses (1,2,3,4) when we store the data as the sub domains are just used for speed. Keeping the subdomains in, means we store four times the data, reduce the caching efficiency, 4x the network bandwidth etc etc. This modification is invisible to the user, so the user still calls the with the full URL and not the stripped down one.
It seems to work very well for our apps, so we will use our SimpleDB instead of PouchDB. We wondered if anybody else needed our code. Since we only simulated the PouchAPI calls, 95% of the code here is the same so we can't take much credit.
The other main advantage is that you no longer get PouchDB conflict errors as the code never has this problem :)
So please let me know if there is any interest, the code is pretty simple and we can put up a new fork on Github if necessary.
Thanks
Rob
The text was updated successfully, but these errors were encountered: