View Javadoc
1   package ca.uhn.fhir.jpa.search.warm;
2   
3   /*-
4    * #%L
5    * HAPI FHIR JPA Server
6    * %%
7    * Copyright (C) 2014 - 2019 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  import org.apache.commons.lang3.builder.EqualsBuilder;
24  import org.apache.commons.lang3.builder.HashCodeBuilder;
25  
26  /**
27   * Denotes a search that should be performed in the background
28   * periodically in order to keep a fresh copy in the query cache.
29   * This improves performance for searches by keeping a copy
30   * loaded in the background.
31   */
32  public class WarmCacheEntry {
33  
34  	private long myPeriodMillis;
35  	private String myUrl;
36  
37  	@Override
38  	public boolean equals(Object theO) {
39  		if (this == theO) {
40  			return true;
41  		}
42  
43  		if (theO == null || getClass() != theO.getClass()) {
44  			return false;
45  		}
46  
47  		WarmCacheEntry that = (WarmCacheEntry) theO;
48  
49  		return new EqualsBuilder()
50  			.append(myPeriodMillis, that.myPeriodMillis)
51  			.append(myUrl, that.myUrl)
52  			.isEquals();
53  	}
54  
55  	@Override
56  	public int hashCode() {
57  		return new HashCodeBuilder(17, 37)
58  			.append(myPeriodMillis)
59  			.append(myUrl)
60  			.toHashCode();
61  	}
62  
63  	public long getPeriodMillis() {
64  		return myPeriodMillis;
65  	}
66  
67  	public WarmCacheEntry setPeriodMillis(long thePeriodMillis) {
68  		myPeriodMillis = thePeriodMillis;
69  		return this;
70  	}
71  
72  	public String getUrl() {
73  		return myUrl;
74  	}
75  
76  	public WarmCacheEntry setUrl(String theUrl) {
77  		myUrl = theUrl;
78  		return this;
79  	}
80  
81  }