Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-30 22:06:11 +01:00
forgejo/modules/nosql
Gusted 9df10c5ac5
[FEAT] Only implement used API of Redis client
- Currently for the `nosql` module (which simply said provides a manager
for redis clients) returns the
[`redis.UniversalClient`](https://pkg.go.dev/github.com/redis/go-redis/v9#UniversalClient)
interface. The interfaces exposes all available commands.
- In generalm, dead code elimination should be able to take care of not
generating the machine code for methods that aren't being used. However
in this specific case, dead code elimination either is disabled or gives
up on trying because of exhaustive call stack the client by
`GetRedisClient` is used.
- Help the Go compiler by explicitly specifying which methods we use.
This reduces the binary size by ~400KB (397312 bytes). As Go no longer
generate machine code for commands that aren't being used.
- There's a **CAVEAT** with this, if a developer wants to use a new
method that isn't specified, they will have to know about this
hack (by following the definition of existing Redis methods) and add the
method definition from the Redis library to the `RedisClient` interface.
2024-08-30 04:33:15 +02:00
..
leveldb.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
manager.go [FEAT] Only implement used API of Redis client 2024-08-30 04:33:15 +02:00
manager_leveldb.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
manager_redis.go [FEAT] Only implement used API of Redis client 2024-08-30 04:33:15 +02:00
manager_redis_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
redis.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
redis_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00