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 cache #70

Merged
merged 1 commit into from
Feb 7, 2023
Merged

refactor cache #70

merged 1 commit into from
Feb 7, 2023

Conversation

CodFrm
Copy link
Contributor

@CodFrm CodFrm commented Feb 7, 2023

fix #66

unit test

package cache

import (
	"runtime"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
)

func Test_newCacheWithJanitor(t *testing.T) {
	c := New(time.Second, time.Second)
	c.Set("k", "v")
	runtime.GC()
	_, ok := c.Items["k"]
	assert.True(t, ok)
	time.Sleep(time.Second * 2)
	_, ok = c.Items["k"]
	assert.False(t, ok)
}

@sonarcloud
Copy link

sonarcloud bot commented Feb 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@Mzack9999 Mzack9999 self-requested a review February 7, 2023 07:31
@Mzack9999 Mzack9999 added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Feb 7, 2023
@Mzack9999 Mzack9999 linked an issue Feb 7, 2023 that may be closed by this pull request
Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

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

@CodFrm, thanks for such a rapid fix and for keeping function signatures consistent!

@Mzack9999 Mzack9999 merged commit 3a79675 into projectdiscovery:main Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory leak in hmap memory
2 participants