server icon indicating copy to clipboard operation
server copied to clipboard

Cache folder content instead of getting it from the server every time

Open jancborchardt opened this issue 9 years ago • 6 comments

(Original issue opened by @oparoz in the old repo)

Every time we enter a folder, a request is made to apps/files/ajax/list.php in order to get data to build the view. It can take between 100ms and 500ms to get that information (on top of the time it takes to connect) on a fast server, depending on the folder's content. Probably much more on a Raspberry.

It turns out that even a 100ms delay is noticeable when you do a A/B comparison.

I propose the following change:

  • cache the data structures which are built after receiving fresh data. It might not be possible to cache everything because of the memory it would require I guess.
  • send the folder's etag to list.php
  • the server returns an empty files array if the etag is the same as the current one
  • the client uses either the cache or the fresh data, depending on if there's been an etag change or not

Letting the Files experts decide if that's feasible and worth it @schiessle @LukasReschke @icewind1991

jancborchardt avatar Oct 03 '16 15:10 jancborchardt

I'd do it the other way around, just send a subfolder listing back as well in the top parent node. So if I'm in the folder /bar/ I also get the response back for /bar/foo and /bar/bar and an ETAG.

Once we then enter the subfolder it's subfolders and ETAGs are requested as well.

I'm not entirely sure how this would behave with external storages, @icewind1991. Thoughts on that?

LukasReschke avatar Oct 03 '16 18:10 LukasReschke

The problem is, that a change in the share information, and favoriting/commenting does not change the etag... Therefor you would then need to do a hard refresh to see if something changed....

nickvergessen avatar Oct 05 '16 08:10 nickvergessen

Well, we could still refresh the page like we do now, but just not get the list of files if we know things haven't changed. I'm not sure how it works in the back-end. I'm assuming you can do partial retrieval of data if a comment has been added per example.

oparoz avatar Oct 05 '16 09:10 oparoz

We use webdav now. So we can just do etag magic. Which might be a ton of fun in javascript ...

But as @nickvergessen points out not all info will be updated then. And we currently (besides polling) have no way to get notified about new comments or shares. Of course we could still fire off a request in the background. And rerender stuff as needed. But that to will be a major rewrite.

rullzer avatar Oct 06 '16 17:10 rullzer

I suppose this issue is still valid? If not, please close this issue!

szaimen avatar May 21 '21 12:05 szaimen

Built-in files to vue. Will close as soon as all views are migrated

skjnldsv avatar Jun 22 '23 16:06 skjnldsv