Closed arafat-java closed 2 years ago
@tangyang9464 @closetool @sagilio
@tangyang9464 @Abingcbc @fabian4
@arafat-java You can use finalizer(a *Adapter)
Refer to https://github.com/casbin/gorm-adapter/blob/master/adapter.go#L81
@arafat-java You can use
finalizer(a *Adapter)
Refer to https://github.com/casbin/gorm-adapter/blob/master/adapter.go#L81
How can I call that finalizer(a *Adapter)
. I have the reference of Adapter that I get via pgAdapter.NewFilteredAdapter
.
Is there any code sample
@Abingcbc isn't finalizer()
a private method? Can it be called from outside?
@Abingcbc isn't
finalizer()
a private method? Can it be called from outside?
Yes, it's my mistake.
@arafat-java The connection will be closed when the adapter is finalized and released by runtime gc. Do you need to manually close the connection immediately? The current version of the adapter doesn't support but we can add this feature.
@Abingcbc plz add this feature, like adding a Close()
method to the adapter.
Thanks guys for the quick resolution
Ours is a cloud based multi tenant system and we cache one adapter instance (
pgAdapter.NewFilteredAdapte
r) for each tenant. However when we remove the adapter instance from the cache the connection to DB is not released So, how to close connection created usingpgAdapter.NewFilteredAdapter