Skip to content

Conversation

ggrossetie
Copy link
Member

resolves #1507

@ggrossetie ggrossetie force-pushed the issue-1507-content-uri-cache branch 2 times, most recently from ea1863b to a59b15d Compare December 31, 2021 19:18
@ggrossetie
Copy link
Member Author

This pull request provides a custom implement of open-uri/cached.
The implement is heavily inspired by: https://github.com/isaacs/node-lru-cache but does not rely on it (mostly to avoid additional dependencies).

This pull requests also introduces an API to interact with the cache:

Asciidoctor.Cache.enable()
Asciidoctor.Cache.disable()
Asciidoctor.Cache.setMax(500)
Asciidoctor.Cache.reset()

@ggrossetie ggrossetie force-pushed the issue-1507-content-uri-cache branch from a59b15d to b7c1940 Compare December 31, 2021 19:26
@ggrossetie ggrossetie marked this pull request as ready for review January 4, 2022 13:02
@ggrossetie ggrossetie requested a review from mojavelinux January 4, 2022 13:02
@ggrossetie ggrossetie force-pushed the issue-1507-content-uri-cache branch from b7c1940 to a938a6a Compare April 24, 2022 15:41
@ggrossetie ggrossetie force-pushed the issue-1507-content-uri-cache branch from a938a6a to aba02c0 Compare April 24, 2022 15:43
Comment on lines +28 to +33
def require_library name, gem_name = true, on_failure = :abort
if name == 'open-uri/cached'
`return Opal.Asciidoctor.Cache.enable()`
end
original_require_library name, gem_name, on_failure
end
Copy link
Member Author

Choose a reason for hiding this comment

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

@mojavelinux I'm a bit concerned about this hack, could we find a better "hook" in Asciidoctor core?

@ggrossetie
Copy link
Member Author

Waiting for a change in Asciidoctor core to properly hook the in-memory cache.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the content URI caching feature in a Node environment

1 participant