Skip to content

Set operation claims insufficient memory #1203

@RealBar

Description

@RealBar

in the current version of commands.go,

func (c cmdable) Set(key string, value interface{}, expiration time.Duration) *StatusCmd {
	args := make([]interface{}, 3, 4)
...
}

is insufficient, causeing subsequent operation

args = append(args, "px", formatMs(expiration))

or

args = append(args, "ex", formatMs(expiration))

to expand the slice capacity from 4 to 8, which is an unnecessary waste.
Since this method Set is so frequently used, this small defect may cause notable performance reduction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions