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

refactor: utilize hexo-util #3996

Merged
merged 3 commits into from Dec 21, 2019
Merged

Conversation

SukkaW
Copy link
Member

@SukkaW SukkaW commented Dec 20, 2019

What does it do?

Utilize hexo-util's CacheStream() & Cache();

How to test

git clone -b utilize-hexo-util-cache https://github.com/sukkaw/hexo.git
cd hexo
npm install
npm test

Screenshots

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

test/scripts/hexo/locals.js Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Dec 20, 2019

Coverage Status

Coverage decreased (-0.01%) to 97.092% when pulling aed8240 on SukkaW:utilize-hexo-util-cache into a381dda on hexojs:master.

@SukkaW SukkaW requested a review from a team December 20, 2019 13:13
@curbengh
Copy link
Contributor

Slightly off-topic to this PR, would caching helps external_link filter? If assuming it's possible to cache all <a> in all pages (including posts), since there bounds to be repetitive links (especially navigation links), maybe it can help (even just a tiny bit, if memory usage doesn't increase).

@SukkaW
Copy link
Member Author

SukkaW commented Dec 21, 2019

@curbengh Cache is already been enabled in hexo-util's isExternalLink() and I think it is enough.

@curbengh
Copy link
Contributor

curbengh commented Dec 21, 2019

what about caching every <a></a>, so it returns processed <a></a>. I'm assuming object cache is faster than String.replace().

@SukkaW
Copy link
Member Author

SukkaW commented Dec 21, 2019

@curbengh I will give it a try in a separate PR.

Copy link
Contributor

@curbengh curbengh left a comment

Choose a reason for hiding this comment

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

tested

@SukkaW SukkaW merged commit 3d80619 into hexojs:master Dec 21, 2019
yoshinorin added a commit to yoshinorin/hexo-related-popular-posts that referenced this pull request Dec 24, 2019
* In hexo 4.2.0 Locals class use hexo-util
* hexojs/hexo#3996
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.

None yet

3 participants