@@ -12,15 +12,14 @@ abstract class CacheFile {
1212 private axiosClient : AxiosInstance ;
1313 private cache : NodePluginArgs [ "cache" ] ;
1414
15- private _hash = "" ;
15+ private hash = "" ;
1616 private guid = "" ;
1717 private cacheId = "" ;
1818 private isCached = false ;
1919
2020 protected constructor ( cache : NodePluginArgs [ "cache" ] , hash : string ) {
2121 this . cache = cache ;
22- this . hash = hash ;
23-
22+ this . setHash ( hash ) ;
2423 this . checkCache ( ) ;
2524
2625 this . axiosClient = Axios . create ( {
@@ -48,7 +47,7 @@ abstract class CacheFile {
4847 return new Promise ( ( resolve ) =>
4948 resolve (
5049 this . path
51- ? { path : this . path , hash : this . _hash }
50+ ? { path : this . path , hash : this . hash }
5251 : this . downloadFile ( url , store , ext ) ,
5352 ) ,
5453 ) ;
@@ -73,8 +72,8 @@ abstract class CacheFile {
7372 . then ( ( path : string ) => this . setCache ( path ) ) ;
7473 }
7574
76- private set hash ( newHash : string ) {
77- this . _hash = newHash ;
75+ private setHash ( newHash : string ) {
76+ this . hash = newHash ;
7877 this . guid = this . generateGUID ( ) ;
7978 this . cacheId = `google-maps-static-cache-${ this . guid } ` ;
8079 }
@@ -91,7 +90,7 @@ abstract class CacheFile {
9190 private async setCache ( path : string ) : Promise < CachePath > {
9291 return this . cache . set ( this . cacheId , path ) . then ( ( ) => {
9392 this . path = path ;
94- return { path : this . path , hash : this . _hash } ;
93+ return { path : this . path , hash : this . hash } ;
9594 } ) ;
9695 }
9796
@@ -100,7 +99,7 @@ abstract class CacheFile {
10099 }
101100
102101 private generateGUID ( ) : string {
103- return crypto . createHash ( "sha256" ) . update ( this . _hash ) . digest ( "hex" ) ;
102+ return crypto . createHash ( "sha256" ) . update ( this . hash ) . digest ( "hex" ) ;
104103 }
105104}
106105
0 commit comments