@@ -34,6 +34,7 @@ export class MetadataCacheRepository {
34
34
constructor ( private readonly cache : KeyValueCache ) { }
35
35
36
36
/**
37
+ * @deprecated This signature will be removed by 04.2021. Please set the version as the last argument.
37
38
* Stores a key-value pair in the cache.
38
39
*
39
40
* @return True if the operation is successful, false otherwise.
@@ -43,6 +44,27 @@ export class MetadataCacheRepository {
43
44
hrn : string ,
44
45
layerId : string ,
45
46
partitions : MetadataApi . Partition [ ]
47
+ ) : boolean ;
48
+
49
+ /**
50
+ * Stores a key-value pair in the cache.
51
+ *
52
+ * @return True if the operation is successful, false otherwise.
53
+ */
54
+ public put (
55
+ rq : PartitionsRequest ,
56
+ hrn : string ,
57
+ layerId : string ,
58
+ partitions : MetadataApi . Partition [ ] ,
59
+ // tslint:disable-next-line: unified-signatures
60
+ version ?: number
61
+ ) : boolean ;
62
+ public put (
63
+ rq : PartitionsRequest ,
64
+ hrn : string ,
65
+ layerId : string ,
66
+ partitions : MetadataApi . Partition [ ] ,
67
+ version ?: number
46
68
) : boolean {
47
69
const partitionsIds = rq . getPartitionIds ( ) ;
48
70
let key : string ;
@@ -51,7 +73,7 @@ export class MetadataCacheRepository {
51
73
key = this . createKey ( {
52
74
hrn,
53
75
layerId,
54
- version : rq . getVersion ( ) ,
76
+ version : version !== undefined ? version : rq . getVersion ( ) ,
55
77
partitionId : metadata . partition
56
78
} ) ;
57
79
this . cache . put ( key , JSON . stringify ( metadata ) ) ;
@@ -63,12 +85,13 @@ export class MetadataCacheRepository {
63
85
key = this . createKey ( {
64
86
hrn,
65
87
layerId,
66
- version : rq . getVersion ( )
88
+ version : version !== undefined ? version : rq . getVersion ( )
67
89
} ) ;
68
90
return this . cache . put ( key , JSON . stringify ( partitions ) ) ;
69
91
}
70
92
71
93
/**
94
+ * @deprecated This signature will be removed by 04.2021. Please set the version as the last argument.
72
95
* Gets a metadata from the cache.
73
96
*
74
97
* @param service The name of the API service for which you want to get the base URL.
@@ -79,6 +102,27 @@ export class MetadataCacheRepository {
79
102
rq : PartitionsRequest ,
80
103
hrn : string ,
81
104
layerId : string
105
+ ) : MetadataApi . Partition [ ] | undefined ;
106
+
107
+ /**
108
+ * Gets a metadata from the cache.
109
+ *
110
+ * @param service The name of the API service for which you want to get the base URL.
111
+ * @param serviceVersion The service version.
112
+ * @return The base URL of the service, or undefined if the base URL does not exist.
113
+ */
114
+ public get (
115
+ rq : PartitionsRequest ,
116
+ hrn : string ,
117
+ layerId : string ,
118
+ // tslint:disable-next-line: unified-signatures
119
+ version ?: number
120
+ ) : MetadataApi . Partition [ ] | undefined ;
121
+ public get (
122
+ rq : PartitionsRequest ,
123
+ hrn : string ,
124
+ layerId : string ,
125
+ version ?: number
82
126
) : MetadataApi . Partition [ ] | undefined {
83
127
const partitionsIds = rq . getPartitionIds ( ) ;
84
128
let key : string ;
@@ -88,7 +132,7 @@ export class MetadataCacheRepository {
88
132
key = this . createKey ( {
89
133
hrn,
90
134
layerId,
91
- version : rq . getVersion ( ) ,
135
+ version : version !== undefined ? version : rq . getVersion ( ) ,
92
136
partitionId
93
137
} ) ;
94
138
@@ -119,7 +163,7 @@ export class MetadataCacheRepository {
119
163
key = this . createKey ( {
120
164
hrn,
121
165
layerId,
122
- version : rq . getVersion ( )
166
+ version : version !== undefined ? version : rq . getVersion ( )
123
167
} ) ;
124
168
125
169
const serializedPartitions = this . cache . get ( key ) ;
0 commit comments