creationix / couch-client

A minimal CouchDB client that easy and powerful
MIT License
101 stars 9 forks source link

revCache never being cleared #16

Closed stellaraccident closed 13 years ago

stellaraccident commented 13 years ago

Hi, Prior to using the library I was reading the source code and couldn't help but notice the odd use of revCache for trying to allow saves without revisions. Leaving aside the question of whether this is a little heavy-handed, I can't see anywhere where you are clearing the revCache entries. Am I reading this right to assume that a long lived CouchClient instance will leak memory continuously? Is a client instance only meant to be used for short interactions?

Thanks.

creationix commented 13 years ago

If I expire the automatic revisions, I might as well not have them there in the first place because the user won't be able to trust it's there. It would be easier for them to just keep track of the revisions on their own and do it the right way. Also, it's not using much memory. I've never hit a problem with it so I don't want to complicate my code with some LRU mechanism. I'd remove the revcache completely before doing that.

Also it's MIT licensed, so you could easily fork it and maintain a version without the cache. I believe someone else already did something like that.

stellaraccident commented 13 years ago

Thanks for the followup. I was mainly wondering if I was misreading/missing something there.