mirror of https://github.com/shred/acme4j
Add Session.purgeDirectoryCache()
parent
d0c2aafaf1
commit
18e56c9d4f
|
@ -311,6 +311,18 @@ public class Session {
|
|||
return resourceMap.get() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Purges the directory cache. Makes sure that a fresh copy of the directory will be
|
||||
* read from the CA on the next time the directory is accessed.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public void purgeDirectoryCache() {
|
||||
setDirectoryLastModified(null);
|
||||
setDirectoryExpires(null);
|
||||
resourceMap.set(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the provider's directory, then rebuild the resource map. The resource map
|
||||
* is unchanged if the {@link AcmeProvider} returns that the directory has not been
|
||||
|
|
|
@ -97,6 +97,13 @@ public class SessionTest {
|
|||
assertThat(session.getDirectoryLastModified()).isEqualTo(now);
|
||||
session.setDirectoryLastModified(null);
|
||||
assertThat(session.getDirectoryLastModified()).isNull();
|
||||
|
||||
session.setDirectoryExpires(now);
|
||||
session.setDirectoryLastModified(now);
|
||||
session.purgeDirectoryCache();
|
||||
assertThat(session.getDirectoryExpires()).isNull();
|
||||
assertThat(session.getDirectoryLastModified()).isNull();
|
||||
assertThat(session.hasDirectory()).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue