blob: 849add176fe14db68aafaab40ff9148bcd1dded4 [file] [log] [blame]
Marc De Leenheerc662d322016-02-18 16:05:10 -08001/*
2 * Copyright 2016 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.drivers.lumentum;
17
18import org.apache.commons.lang3.tuple.Pair;
19import org.apache.felix.scr.annotations.Component;
20import org.apache.felix.scr.annotations.Service;
21import org.onosproject.net.flow.FlowId;
22
23import java.util.HashMap;
24import java.util.Map;
25
26@Component(immediate = true, enabled = true)
27@Service
28public class DefaultCrossConnectCache implements CrossConnectCache {
29 private final Map<Integer, Pair<FlowId, Integer>> cache = new HashMap<>();
30
31 @Override
32 public Pair<FlowId, Integer> get(int hash) {
33 return cache.get(hash);
34 }
35
36 @Override
37 public void set(int hash, FlowId flowId, int priority) {
38 cache.put(hash, Pair.of(flowId, priority));
39 }
40
41 @Override
42 public void remove(int hash) {
43 cache.remove(hash);
44 }
45}