opened
EtienneBruines
username_0
Currently, `IStore` is defined as:

```go

// IStore is the interface which all session stores should implement
type IStore interface {
	Get(interface{}) interface{}
	GetString(key interface{}) string
	GetInt(key interface{}) int
	Set(interface{}, interface{}) error
	Delete(interface{}) error
	Clear() error
	VisitAll(func(interface{}, interface{}))
	GetAll() map[interface{}]interface{}
	ID() string
	LastAccessedTime() time.Time
	SetLastAccessedTime(time.Time)
	Destroy()
}
```

I would love if it included an `Exists(interface{}) bool`. This way one can check if a certain key is present, without caring at all about its contents. I could implement it and submit a PR if you'd like. 

Thoughts?
Feature request: session.Exists
issue
created
kataras
username_1
Get returns nil if the key doesnt exists :P
comment
created
EtienneBruines
username_0
But if it exists, some data may be retrieved from a backend database, while it's not being used? (i.e. you only care *if* it exists; you're not using it afterwards)
comment
closed
kataras
username_1
issue
created
kataras
username_1
The store doesn't ` retrieve from a backend while it's not being used, the `Exists`will do the same thing as this: 
```go
if v:= store.Get("key"); v != nil { // if store.Exists("key") {  } else { }
        // exists
 }else {
  // doesnt exists
}
```` 

Let's keep things, we will have duplication of code with the `Exists`:/
comment
reopened
kataras
username_1
Currently, `IStore` is defined as:

```go

// IStore is the interface which all session stores should implement
type IStore interface {
	Get(interface{}) interface{}
	GetString(key interface{}) string
	GetInt(key interface{}) int
	Set(interface{}, interface{}) error
	Delete(interface{}) error
	Clear() error
	VisitAll(func(interface{}, interface{}))
	GetAll() map[interface{}]interface{}
	ID() string
	LastAccessedTime() time.Time
	SetLastAccessedTime(time.Time)
	Destroy()
}
```

I would love if it included an `Exists(interface{}) bool`. This way one can check if a certain key is present, without caring at all about its contents. I could implement it and submit a PR if you'd like. 

Thoughts?

<bountysource-plugin>
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/35416290-feature-request-session-exists?utm_campaign=plugin&utm_content=tracker%2F30189074&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F30189074&utm_medium=issues&utm_source=github).
</bountysource-plugin>
Feature request: session.Exists
issue
closed
kataras
username_1
issue