Skip to content

Conversation

@simonthum
Copy link

Hi,

I have written a small extension to use FileCache as a raw byte store. I can thus store byte[]s or Streams and FileCache will return accessible path names. This is to support SendFile or scatter/gather IO.

So far the results look good in my use case. I added a bit of documentation and file enumeration instead of array creation.

@acarteas
Copy link
Owner

Seems interesting. I'll try to take a look in the next few days. It doesn't look like it changes the API at all, correct?

@simonthum
Copy link
Author

Yes, I avoided API and behavorial changes.

I will look into the failing CacheSizeTest. AFAICT the changes should not break it, at least not by design.

@simonthum
Copy link
Author

OK, I broke the test. It seems to be about the cache size tracking; maybe you'll spot my mistake right away but I will not have time to fix it before next monday.

@acarteas
Copy link
Owner

Ya, I noticed that too. I'll try poking around but with Thanksgiving coming up soon, I might be a bit lazy getting to it.

This intends to support zerocopy/SendFile scenarios. There
is no serialization in this mode, the cache is basically
managing a bunch of files.

The mode intentionally only accepts byte[] or streams,
it does not support fetching them to avoid memory and
stream lifetime issues.

Because of the lifetime issue, a configurable
safety margin is added to the expiry logic.
@simonthum
Copy link
Author

The fix was to discount for the possibility that a file write replaces an existing file (and thus payload size).

I hope appveyor agrees.

@acarteas
Copy link
Owner

Looks good!

@acarteas acarteas merged commit f85b9b5 into acarteas:master Nov 27, 2018
@simonthum
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants