Skip to content
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

Memo docs from community with love. #152

Merged
merged 5 commits into from
Feb 13, 2020

Conversation

optician
Copy link
Contributor

No description provided.

docs/memo.md Outdated
* TTL. Expired values are discarded on access.
* Forced invalidation based on time.

Missed:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess something like Not implemented would sound a bit better than Missed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but dont see a point.

Copy link
Contributor Author

@optician optician Feb 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont like not implemented at all. It is like a promiss. Changed to a neutral.

docs/memo.md Outdated
import scala.concurrent.duration.FiniteDuration
import java.util.concurrent.TimeUnit

def effect[F[_] : Sync]: F[Int] = Sync[F].delay(println("called")) >> 335.pure[F]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is >> 335.pure[F] intentional? Since you have cats.syntax.functor._ import, you could write that like Sync[F].delay(println("called")).as(335)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

Number 335
*/
```
How it works. Cached value remembers time of read access during update (T_update). On any read access tofu selects a time to compare with T_update (update value when `T_selected > T_update`). Selection is based on a formula `max(T_now - TTL, T_CacheControl)`. If you set `T_CacheControl = T_now` then always T_CacheControl is more than T_update. After update of a value, T_update equals T_CacheControl.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to emphasize the name of the block to make it more distinguishable visually from other text, something like header would do.
Also, not sure about tofu selects part. Library itself doesn't select anything, it's an implementation that makes any work.

Copy link
Contributor Author

@optician optician Feb 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This text is a part of the sample. Why it have be separated?

Library itself doesn't select anything

It's about selection of a computational branch.

Odomontois
Odomontois previously approved these changes Feb 13, 2020
@Odomontois Odomontois merged commit b3c1c63 into tofu-tf:master Feb 13, 2020
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.

3 participants