-
- Notifications
You must be signed in to change notification settings - Fork 45
FileStorage: Create subdirs when using the method derive #33
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not thread safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this solution? - http://stackoverflow.com/questions/15356189/creating-a-directory-from-multiple-threads/21626808#21626808
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@milo What problem it can cause?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dg Let's say only a dir/
exists and 1st thread is creating dir/aaa/bbb/
and 2nd dir/aaa/ccc/
. When they start in the same time, 1st creates dir/aaa/
and 2nd tries too. 1st is success and continues to create dir/aaa/bbb/
but 2nd fails and ends, so dir/aaa/ccc/
does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recalled nette/nette@0e23c0a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@milo thanx!
Btw, FileStorage is using only one level of directories, isn't it? So this PR is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dg Imho, purpose is that $cache->derive('a')->derive('b')->derive('c')->save('key', 'val');
will create tmp/_a/_b/_c
, now it creates tmp/_%00a%00b%00c
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I see!
2f8f6fb
to 8c9cca3
Compare 0aed862
to a0c400e
Compare 54c618b
to 62a27d9
Compare ec9e432
to e07955b
Compare 492413c
to b0b475e
Compare 6037e83
to 1fe69cc
Compare 6df4f89
to 30051c1
Compare 2f60360
to 93f335f
Compare 41b5503
to 327c2bf
Compare 3982670
to d89af84
Compare 40be743
to a116cb9
Compare ea335de
to ccec70b
Compare 3ce492d
to fb5c89d
Compare d31ad07
to a71faf1
Compare 2d5f7a5
to 91c8061
Compare b91fc47
to 05451a0
Compare
I do not know if it was the intention, but this behavior seems to me better. Especially if there is a large number of cached files.