mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
feature:
广告、缓存
This commit is contained in:
@@ -52,17 +52,6 @@ const SideArea = ({ title, tags, currentTag, post, posts, categories, currentCat
|
||||
</section>
|
||||
)}
|
||||
|
||||
<section className='rounded-xl shadow-lg py-4 mt-5 px-2 bg-white dark:bg-gray-800 hover:shadow-2xl duration-200'>
|
||||
{/* 展示广告 */}
|
||||
<ins className="adsbygoogle"
|
||||
style={{ display: 'block' }}
|
||||
data-adtest="on"
|
||||
data-ad-client="ca-pub-2708419466378217"
|
||||
data-ad-slot="8807314373"
|
||||
data-ad-format="auto"
|
||||
data-full-width-responsive="true"></ins>
|
||||
</section>
|
||||
|
||||
{/* 分类 */}
|
||||
{categories && (
|
||||
<section className='rounded-xl shadow-lg py-4 mt-5 bg-white dark:bg-gray-800 hover:shadow-2xl duration-200'>
|
||||
@@ -94,6 +83,17 @@ const SideArea = ({ title, tags, currentTag, post, posts, categories, currentCat
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
<section className='rounded-xl shadow-lg py-4 mt-5 px-2 bg-white dark:bg-gray-800 hover:shadow-2xl duration-200'>
|
||||
{/* 展示广告 */}
|
||||
<ins className="adsbygoogle"
|
||||
style={{ display: 'block' }}
|
||||
data-adtest="on"
|
||||
data-ad-client="ca-pub-2708419466378217"
|
||||
data-ad-slot="8807314373"
|
||||
data-ad-format="auto"
|
||||
data-full-width-responsive="true"></ins>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{post && post.toc && post.toc.length > 1 && (
|
||||
|
||||
1
lib/cache/cache_manager.js
vendored
1
lib/cache/cache_manager.js
vendored
@@ -1,4 +1,3 @@
|
||||
import BLOG from '@/blog.config'
|
||||
import { getCacheFromMemory, setCacheToMemory } from '@/lib/cache/memory_cache'
|
||||
const enableCache = true // 生产环境禁用
|
||||
|
||||
|
||||
5
lib/cache/memory_cache.js
vendored
5
lib/cache/memory_cache.js
vendored
@@ -1,9 +1,12 @@
|
||||
import cache from 'memory-cache'
|
||||
import BLOG from 'blog.config'
|
||||
|
||||
const cacheTime = BLOG.isProd ? 60 : 60 * 60
|
||||
|
||||
export async function getCacheFromMemory (key, options) {
|
||||
return cache.get(key)
|
||||
}
|
||||
|
||||
export async function setCacheToMemory (key, data) {
|
||||
await cache.put(key, data, 60 * 1000) // 1 minutes
|
||||
await cache.put(key, data, cacheTime * 1000)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user