wildskyf / TextareaCache

Browser Add-on: Automatically save the content in Textarea.
MIT License
66 stars 7 forks source link

autoclear after a few days or weeks in option page #18

Closed wildskyf closed 5 years ago

wildskyf commented 7 years ago

Thanks to Tim. This might be a good option for users.

Gitoffthelawn commented 7 years ago

I would like to see it autoclear at the end of every session, assuming the end-of-session was not caused by the browser crashing.

wildskyf commented 7 years ago

@Gitoffthelawn I have opened #21 for it though I don't know whether API is okay to implement that feature. Thank you. :)

Gitoffthelawn commented 7 years ago

Thank you!

bendover22 commented 7 years ago

By the proposed, "autoclear after a few days or weeks in option page," do you mean autoclear (only) entries older than n days?

Another suggestion: as of v2.3 there's still no way to select multiple entries at once in the drop list to delete them.
AFAIK, only one entry can be selected - to show in TACL's display, before you can delete it.

That's fine for 1 or 2 entries. Very tedious for 10+, deleting one at a time. That's assuming user doesn't want to "delete all cache."

I'm not sure how hard it'd be to add the option to select a continuous block of entries (e.g., Shift + click), or to select several non-adjacent entries (e.g., Ctrl + click - random entries), then delete selected items at once.

An "autoclear entries that are n days old" would take care of some, but not all of my suggestion.

I can see users wanting to delete multiple, specific entries - before they reach a specified "auto-clear after n days." Say, for medical or legal correspondence. HTH.

wildskyf commented 6 years ago

@bendover22, I have added a new issue #45, and add your comment there. Thanks for your suggestions!

lapineige commented 6 years ago

This would be a great addition :) For the time, maybe it can also be configured in hours/minutes, for instance for privacy reasons.

bendover22 commented 6 years ago

I don't know what the "date API" allows, so I'm not sure what to suggest. If it will allow entering specific dates, that would be great. If it only allows entering, "Delete older than last 1 / 2 / 3 weeks", then perhaps, "Delete last 1 / 2 or ... months" Hopefully something where anything older than n weeks or n months is deleted.
I have no need to store months of entries. (As of now, I can't delete any from the UI). If entries were that important, I'd store them elsewhere.

The addon isn't really supposed to be long term storage of text entries, is it?

wildskyf commented 5 years ago

Hi all, I have implement the auto clear feature at version 4.1.1.

By default, auto-clear is set to disable, you could enable this feature in the option page.

Gitoffthelawn commented 5 years ago

I'll take a look at it soon! Thanks!

Gitoffthelawn commented 5 years ago

I took a look at the autoclear functionality. I'm trying to understand it a little better.

Let's say you tell it to autoclear after 5 hours. Does that mean that any items more than 5 hours old are deleted, but newer items are kept (until they are at least 5 hours old)? This would be pretty neat.

Or does it mean that everything is cleared every 5 hours?

Or something else?

wildskyf commented 5 years ago

Hi @Gitoffthelawn thx for your asking.

AutoClear will remove cache, which is saved for a certain time.

For example, here are 3 caches, they were saved A) 10 min ago B) 10 day ago C) 10 month ago

if you set the auto clear time to 1 min, they will be all clear when the checker are triggered. if you set the auto clear time to 50 day, cache B & C will be removed, but A will not. (but it will be removed when its saved time become 50day ago.)

Gitoffthelawn commented 5 years ago

Thanks @wildskyf !

That sounds great.

I think there is one mistake in the example. It says: "if you set the auto clear time to 50 day, cache B & C will be removed, but A will not. (but it will be removed when its saved time become 50day ago.)"

I think you meant: "if you set the auto clear time to 50 day, cache C will be removed, but A and B will not. (but they will be removed when their saved times become 50day ago.)"

Does that sound right?

Also, when is the checker triggered?

wildskyf commented 5 years ago

I think you meant: "if you set the auto clear time to 50 day, cache C will be removed, but A and B will not. (but they will be removed when their saved times become 50day ago.)"

YES! That's what I mean! Sorry for the confusion. :)

Checker will be triggered when browser startup and once every minute. Let's see whether there is any performance issue, I think there will not be. (After all, it is recommended implement by official example.)

Gitoffthelawn commented 5 years ago

:-)

If "auto clear old cache" is not checked, is the checker still triggered, or does the check not take place at all?

wildskyf commented 5 years ago

The checker function will be called, but it will early return when that "auto clear old cache" is not checked.

the code of related checker is at here: https://github.com/wildskyf/TextareaCache/blob/master/ta_bg.js#L220-L247

Gitoffthelawn commented 5 years ago

Thanks for the link to that section of the code. :+1:

Would it be possible to not call the checker at all in that case?

wildskyf commented 5 years ago

Yes, it's possible, I could add/remove listener as long as user toggle the auto-clear option. But this might cause code more complicating.

I think an early-returned function might not cause expensive performance issue too much, so I prefer observe for a while. If there does be any performance issue, I might consider to change the current state of code.

and, Pull Request Welcome. ;P

wildskyf commented 5 years ago

Currently, the auto-clear feature is implemented, so this issue could be close.