-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update SDK to automatically pull runtime URL when a session starts #28
base: master
Are you sure you want to change the base?
Conversation
src/main/java/com/salesforce/einsteinbot/sdk/client/BasicChatbotClientImpl.java
Outdated
Show resolved
Hide resolved
src/test/java/com/salesforce/einsteinbot/sdk/client/BasicChatbotClientTest.java
Outdated
Show resolved
Hide resolved
src/main/java/com/salesforce/einsteinbot/sdk/client/BasicChatbotClientImpl.java
Outdated
Show resolved
Hide resolved
return Optional.ofNullable(val); | ||
} | ||
|
||
public Optional<Object> getObject(String key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would help here is to turn the Cache
into a generic Cache<T>
. That would let you avoid using the concrete type in BaseChatbotClientImpl
and creating the set/getObject
methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, we can make to use generic type.
this.basePath = basePath; | ||
this.webClientBuilder = webClientBuilder; | ||
this.clientWrapper = ClientFactory.createClient(basePath, webClientBuilder); | ||
this.cache = new InMemoryCache(DEFAULT_TTL_SECONDS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See note about making Cache
generic here, then you can just have a protected Cache<Object> cache
and handle the casting on a per-key basis (or create a POJO to store if you want to avoid casing between String|Object
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think we want to hardcode to InMemoryCache
, it's better allow user to provide cache implementation.
src/main/java/com/salesforce/einsteinbot/sdk/client/BasicChatbotClientImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/salesforce/einsteinbot/sdk/client/BasicChatbotClientImpl.java
Outdated
Show resolved
Hide resolved
return Optional.ofNullable(val); | ||
} | ||
|
||
public Optional<Object> getObject(String key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, we can make to use generic type.
@@ -25,7 +25,7 @@ public class RedisCache implements Cache { | |||
private static final Long DEFAULT_TTL_SECONDS = 259140L; // 2 days, 23 hours, 59 minutes | |||
|
|||
private JedisPool jedisPool; | |||
private long ttlSeconds; | |||
private final long ttlSeconds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also support storing/retrieving objects in RedisCache implementation.
this.basePath = basePath; | ||
this.webClientBuilder = webClientBuilder; | ||
this.clientWrapper = ClientFactory.createClient(basePath, webClientBuilder); | ||
this.cache = new InMemoryCache(DEFAULT_TTL_SECONDS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think we want to hardcode to InMemoryCache
, it's better allow user to provide cache implementation.
5091e11
to
94017a6
Compare
9f027e2
to
4ee9ac9
Compare
4ee9ac9
to
b8a9c37
Compare
No description provided.