Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
add files
Browse files Browse the repository at this point in the history
  • Loading branch information
jsimone committed Nov 18, 2011
0 parents commit ce3709f
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.classpath
.settings/
target
.project
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worker: sh target/bin/memcache
57 changes: 57 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.heroku.devcenter</groupId>
<artifactId>memcacheSample</artifactId>
<version>0.0.1-SNAPSHOT</version>

<repositories>
<repository>
<id>spy</id>
<name>Spy Repository</name>
<layout>default</layout>
<url>http://files.couchbase.com/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>spy</groupId>
<artifactId>spymemcached</artifactId>
<version>2.7.3</version>
<scope>provided</scope>
</dependency>
</dependencies>


<build>
<plugins>
<!-- The maven app assembler plugin will generate a script that sets up the classpath and runs your project -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<assembleDirectory>target</assembleDirectory>
<programs>
<program>
<mainClass>com.force.sample.Main</mainClass>
<name>memcache</name>
</program>
</programs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
33 changes: 33 additions & 0 deletions src/main/java/com/heroku/devcenter/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.heroku.devcenter;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;

import net.spy.memcached.MemcachedClient;

public class Main {

/**
* @param args
* @throws IOException
* @throws URISyntaxException
*/
public static void main(String[] args) throws IOException, URISyntaxException {
// AuthDescriptor ad = new AuthDescriptor(new String[]{"PLAIN"},
// new PlainCallbackHandler("app1805387@heroku.com", "k/aoMGr9EcKo4Sa6"));
// ConnectionFactoryBuilder factoryBuilder = new ConnectionFactoryBuilder();
// ConnectionFactory cf = factoryBuilder.setProtocol(Protocol.BINARY).setAuthDescriptor(ad).build();

URI base = new URI("http://" + System.getenv("MEMCACHE_SERVERS") + ":11211");
ArrayList<URI> baseURIs = new ArrayList<URI>();
baseURIs.add(base);
MemcachedClient memcachedClient = new MemcachedClient(baseURIs, "default", System.getenv("MEMCACHE_USERNAME"), System.getenv("MEMCACHE_PASSWORD"));

// MemcachedClient memcachedClient = new MemcachedClient(AddrUtil.getAddresses("mc7.ec2.northscale.net:11211"), "app1805387@heroku.com", "k/aoMGr9EcKo4Sa6");
memcachedClient.add("test", 0, "testData");
System.out.println(memcachedClient.get("test"));
}

}

0 comments on commit ce3709f

Please sign in to comment.