コード例 #1
0
ファイル: MapService.java プロジェクト: rocio/hazelcast
  public boolean compare(String mapName, Object value1, Object value2) {
    if (value1 == null && value2 == null) {
      return true;
    }
    if (value1 == null) {
      return false;
    }
    if (value2 == null) {
      return false;
    }

    MapContainer mapContainer = getMapContainer(mapName);
    return mapContainer.getRecordFactory().isEquals(value1, value2);
  }
コード例 #2
0
ファイル: MapService.java プロジェクト: rocio/hazelcast
  public Record createRecord(
      String name, Data dataKey, Object value, long ttl, boolean shouldSchedule) {
    MapContainer mapContainer = getMapContainer(name);
    Record record = mapContainer.getRecordFactory().newRecord(dataKey, value);

    if (shouldSchedule) {
      // if ttl is 0 then no eviction. if ttl is -1 then default configured eviction is applied
      if (ttl < 0 && mapContainer.getMapConfig().getTimeToLiveSeconds() > 0) {
        scheduleTtlEviction(
            name, record, mapContainer.getMapConfig().getTimeToLiveSeconds() * 1000);
      } else if (ttl > 0) {
        scheduleTtlEviction(name, record, ttl);
      }
      if (mapContainer.getMapConfig().getMaxIdleSeconds() > 0) {
        scheduleIdleEviction(name, dataKey, mapContainer.getMapConfig().getMaxIdleSeconds() * 1000);
      }
    }
    return record;
  }