Skip to content

Commit e71147d

Browse files
committed
Update CustomerDataService.java
1 parent 90e8b48 commit e71147d

1 file changed

Lines changed: 57 additions & 57 deletions

File tree

‎spring-all/src/main/java/org/baeldung/caching/example/CustomerDataService.java‎

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,84 +10,84 @@
1010
@CacheConfig("addressDemo")
1111
public class CustomerDataService {
1212

13-
/** The cache manager. */
14-
@Autowired
15-
CacheManager cacheManager;
13+
/** The cache manager. */
14+
@Autowired
15+
CacheManager cacheManager;
1616

17-
/**
18-
* The method returns the customer's address,
19-
only it doesn't find it the cache- addresses and directory.
20-
*
21-
* @param customer the customer
22-
* @return the address
23-
*/
17+
/**
18+
* The method returns the customer's address,
19+
only it doesn't find it the cache- addresses and directory.
20+
*
21+
* @param customer the customer
22+
* @return the address
23+
*/
2424

25-
@Cacheable("addresses", “directory”)
25+
@Cacheable("addresses", “directory”)
2626

27-
public String getAddress1(Customer customer) {
27+
public String getAddress1(Customer customer) {
2828

29-
return customer.getAddress();
30-
}
29+
return customer.getAddress();
30+
}
3131

32-
/**
33-
* The method returns the customer's address,
34-
but refreshes all the entries in the cache to load new ones.
35-
*
36-
* @param customer the customer
37-
* @return the address
38-
*/
32+
/**
33+
* The method returns the customer's address,
34+
but refreshes all the entries in the cache to load new ones.
35+
*
36+
* @param customer the customer
37+
* @return the address
38+
*/
3939

40-
@CacheEvict(value="addresses", allEntries=true)
40+
@CacheEvict(value="addresses", allEntries=true)
4141

42-
public String getAddress2(Customer customer) {
42+
public String getAddress2(Customer customer) {
4343

44-
return customer.getAddress();
45-
}
44+
return customer.getAddress();
45+
}
4646

47-
/**
48-
* The method returns the customer's address,
49-
but not before selectively evicting the cache as per specified paramters.
50-
*
51-
* @param customer the customer
52-
* @return the address
53-
*/
47+
/**
48+
* The method returns the customer's address,
49+
but not before selectively evicting the cache as per specified paramters.
50+
*
51+
* @param customer the customer
52+
* @return the address
53+
*/
5454

55-
@Caching(evict = { @CacheEvict("addresses"), @CacheEvict(value="directory", key="customer.name") })
55+
@Caching(evict = { @CacheEvict("addresses"), @CacheEvict(value="directory", key="customer.name") })
5656

57-
public String getAddress3(Customer customer) {
57+
public String getAddress3(Customer customer) {
5858

59-
return customer.getAddress();
60-
}
59+
return customer.getAddress();
60+
}
6161

62-
/**
63-
* The method uses the class level cache to look up for entries.
64-
*
65-
* @param customer the customer
66-
* @return the address
67-
*/
62+
/**
63+
* The method uses the class level cache to look up for entries.
64+
*
65+
* @param customer the customer
66+
* @return the address
67+
*/
6868

69-
@Cacheable // parameter not required as we have declared it using @CacheConfig
69+
@Cacheable // parameter not required as we have declared it using @CacheConfig
7070

71-
public String getAddress4(Customer customer) {
71+
public String getAddress4(Customer customer) {
7272

73-
return customer.getAddress();
74-
}
73+
return customer.getAddress();
74+
}
7575

76-
/**
77-
* The method selectively caches the results that meet the predefined criteria.
78-
*
79-
* @param customer the customer
80-
* @return the address
81-
*/
76+
/**
77+
* The method selectively caches the results that meet the predefined criteria.
78+
*
79+
* @param customer the customer
80+
* @return the address
81+
*/
8282

8383

84-
@CachePut(value="addresses", condition=”#customer.name=’Tom’”)
85-
@CachePut(value="addresses", unless=”#result.length>64”)
84+
@CachePut(value="addresses", condition=”#customer.name=’Tom’”)
85+
@CachePut(value="addresses", unless=”#result.length>64”)
8686

87-
public String getAddress5(Customer customer) {
87+
public String getAddress5(Customer customer) {
8888

89-
return customer.getAddress();
90-
}
89+
return customer.getAddress();
90+
}
9191

9292

9393
}

0 commit comments

Comments
 (0)