profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/chenyahui/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

CyC2018/Job-Recommend 2393

🔎 互联网内推信息(社招、校招、实习)

chenyahui/AnnotatedCode 806

知名开源代码库的注释版:C++、Golang等

chenyahui/gin-cache 27

:rocket: A high performance gin middleware to cache http response. Compared to gin-contrib/cache, It has a huge performance improvement. 高性能gin缓存中间件,相比于官方版本,有巨大性能提升。

chenyahui/dbdoc 21

A tool for automatically generating database documents

chenyahui/pure-web 12

使用stylish去除各大网站的广告

chenyahui/practical_tools 7

实用小工具

chenyahui/ToyJVM 5

A toy jvm

chenyahui/ClassViewer 4

a tool for helping studying jvm classfile's bytecode layout

chenyahui/let 2

A multiple reactors network library based on libevent

startedrcrowley/go-metrics

started time in 15 hours

issue openedchenyahui/chenyahui.github.io

我的开源代码 | 编程沉思录

https://www.cyhone.com/opensource/

gin-cache 地址: github.com/chenyahui/gin-cache 一个高性能gin缓存中间件,相比于官方版本,有巨大性能提升。

created time in a day

startedfacebook/prophet

started time in 3 days

push eventchenyahui/gin-cache

chenyahui

commit sha 490280246997e19b4cf0542f21319bff7da25bbe

remove useless code

view details

push time in 4 days

push eventchenyahui/gin-cache

chenyahui

commit sha 4668f5350463e2738f1da8fdbd36729584e91f76

chore: add golangci-lint in github workflow

view details

push time in 4 days

push eventchenyahui/gin-cache

chenyahui

commit sha 106ef2ed37c17955bf6ba481b2d72adc932a4715

bump deps versions

view details

push time in 4 days

created tagchenyahui/gin-cache

tagv1.2.0

:rocket: A high performance gin middleware to cache http response. Compared to gin-contrib/cache, It has a huge performance improvement. 高性能gin缓存中间件,相比于官方版本,有巨大性能提升。

created time in 4 days

release chenyahui/gin-cache

v1.2.0

released time in 4 days

push eventchenyahui/gin-cache

chenyahui

commit sha b1fcc9ac84cc8c87bf1c7c168796cca9bb28c25c

feat: support WithSingleFlightForgetTimeout to reduce the impact of long tail requests (#4)

view details

push time in 4 days

push eventchenyahui/gin-cache

chenyahui

commit sha c51d266825346d2837ed876d3c51c07b91a8e10e

docs: add more comment

view details

push time in 5 days

issue commentchenyahui/gin-cache

同时使用缓存中间件和跨域中间件的时候,跨域就失效了

@qqisee 已fix。之前的实现中从缓存中取header的时候,使用了add函数,但这里其实用set会更好些。这样就不会出现跨域会多次设置的问题了。

可以尝试更新v1.1.1版本,cors放在cache之前之后都可以了~

qqisee

comment created time in 5 days

created tagchenyahui/gin-cache

tagv1.1.1

:rocket: A high performance gin middleware to cache http response. Compared to gin-contrib/cache, It has a huge performance improvement. 高性能gin缓存中间件,相比于官方版本,有巨大性能提升。

created time in 5 days

release chenyahui/gin-cache

v1.1.1

released time in 5 days

push eventchenyahui/gin-cache

chenyahui

commit sha 36a138fbf625c66da2b8a58f25669b7aa4d135c8

fix: set header from cache instead of add (#3)

view details

push time in 5 days

issue commentchenyahui/gin-cache

同时使用缓存中间件和跨域中间件的时候,跨域就失效了

@qqisee 我排查下这个问题,按照预期的行为,cors放在cache中间件之前的也应该可以生效的~

qqisee

comment created time in 5 days

issue commentchenyahui/gin-cache

同时使用缓存中间件和跨域中间件的时候,跨域就失效了

解决了,是中间件的顺序问题

@qqisee 好的~ 另外,用的跨域中间件是 https://github.com/gin-contrib/cors 吗?

qqisee

comment created time in 5 days

release chenyahui/gin-cache

v1.1.0

released time in 5 days

created tagchenyahui/gin-cache

tagv1.1.0

:rocket: A high performance gin middleware to cache http response. Compared to gin-contrib/cache, It has a huge performance improvement. 高性能gin缓存中间件,相比于官方版本,有巨大性能提升。

created time in 5 days

push eventchenyahui/gin-cache

chenyahui

commit sha 3889a49a9e410b1e431892d9ca7be4bdfb75fc7f

rename HitCacheCallback to WithOnHitCache

view details

push time in 5 days

push eventchenyahui/gin-cache

chenyahui

commit sha d5eb2f77273d83b7153b6343a923b814e42011df

feat: add hit cache callback option

view details

push time in 5 days

startedbmhatfield/go-runtime-metrics

started time in 12 days

startedgo-redsync/redsync

started time in 19 days

startednatefinch/lumberjack

started time in 19 days

issue commentgin-contrib/cache

Why make CachePage public?

Agree above. The method CachePage is NOT safe in high-concurrency. It will cause wrong-repeating data in response. There is a simple code demo:

r.GET("/data", cache.CachePage(redisCache, time.Second * 5, func (c *gin.Context) {
	c.JSON(200, map[string]interface{}{
		"success": true,
	})
}))
// sometime it responds with `{"success": true}{"success": true}` in high-concurrency

I have a new repo gin-cache, solve the problem of high concurrency safe, and also has a huge performance improvement. weclome to use gin-cache~

Yeah~ I'm already reading the code now, and I think it had done what I want to do to improve the performance. Really good job for me. Otherwise, is it possible to be merged into the original gin-contrib/cache? That will be more helpful for the newcomer.

I provide a pull request before, but it has not been merged yet. https://github.com/gin-contrib/cache/pull/73/commits/27904e5d7304f2ab9302a1a1e364deaf2ec46890

chenyahui

comment created time in a month

issue commentgin-contrib/cache

Why make CachePage public?

I provide a pull request before, but it has not been merged yet. https://github.com/gin-contrib/cache/pull/73/commits/27904e5d7304f2ab9302a1a1e364deaf2ec46890

chenyahui

comment created time in a month

issue commentgin-contrib/cache

Why make CachePage public?

Agree above. The method CachePage is NOT safe in high-concurrency. It will cause wrong-repeating data in response. There is a simple code demo:

r.GET("/data", cache.CachePage(redisCache, time.Second * 5, func (c *gin.Context) {
	c.JSON(200, map[string]interface{}{
		"success": true,
	})
}))
// sometime it responds with `{"success": true}{"success": true}` in high-concurrency

I have a new repo gin-cache, solve the problem of high concurrency safe, and also has a huge performance improvement. weclome to use gin-cache~

chenyahui

comment created time in a month

issue closedchenyahui/gin-cache

Is there a way to invalidate cache?

For example I put the cache middleware for a GET endpoint, but there's also a POST endpoint which supposed to be updating the results fetched from the GET endpoint. Therefore, whenever I call the POST endpoint, I would like whatever cache exists on the GET endpoint to be invalidated immediately so I could return the most up to date results.

Is there a way to accommodate this mechanism into gin-cache?

closed time in a month

habibrosyad

pull request commentgrafana/grafana

refactor: simplify serverlock code

hi, @idafurjes , There is a PR for simplify the ServerLock code, PTAL~

chenyahui

comment created time in a month