{"id":13529808,"url":"https://github.com/graphaware/neo4j-expire","last_synced_at":"2025-10-06T07:30:27.489Z","repository":{"id":57724717,"uuid":"49227948","full_name":"graphaware/neo4j-expire","owner":"graphaware","description":"GraphAware Module for Expiring (Deleting) Nodes and Relationships","archived":true,"fork":false,"pushed_at":"2021-05-05T19:23:42.000Z","size":206,"stargazers_count":29,"open_issues_count":0,"forks_count":10,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-01-16T09:38:40.260Z","etag":null,"topics":["java","neo4j","neo4j-graphaware-framework"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphaware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-07T20:09:47.000Z","updated_at":"2023-10-17T03:59:36.000Z","dependencies_parsed_at":"2022-09-02T07:01:59.726Z","dependency_job_id":null,"html_url":"https://github.com/graphaware/neo4j-expire","commit_stats":null,"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphaware%2Fneo4j-expire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphaware%2Fneo4j-expire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphaware%2Fneo4j-expire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphaware%2Fneo4j-expire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphaware","download_url":"https://codeload.github.com/graphaware/neo4j-expire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235510114,"owners_count":19001650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","neo4j","neo4j-graphaware-framework"],"created_at":"2024-08-01T07:00:39.568Z","updated_at":"2025-10-06T07:30:22.171Z","avatar_url":"https://github.com/graphaware.png","language":"Java","funding_links":[],"categories":["Extensions","REST API"],"sub_categories":["REST API","Other"],"readme":"GraphAware Neo4j Expire - RETIRED\n=======================\n\n## GraphAware Neo4j Expire Has Been Retired\nAs of May 2021, this [repository has been retired](https://graphaware.com/framework/2021/05/06/from-graphaware-framework-to-graphaware-hume.html).\n\nGraphAware Expire is a simple library that automatically deletes nodes and relationships from the database when they've\nreached their expiration date or time-to-live (TTL).\n\n## Community vs Enterprise\n\nThis open-source (GPL) version of the module is compatible with GraphAware Framework Community (GPL), which in turn \nis compatible with Neo4j Community Edition (GPL) only. It *will not work* with Neo4j Enterprise Edition, which is a \nproprietary and commercial software product of Neo4j, Inc..\n\nGraphAware offers an Enterprise version of the GraphAware Framework to licensed users of Neo4j Enterprise Edition.\nPlease [get in touch](mailto:info@graphaware.com) to receive access.\n\nGetting the Software\n--------------------\n\n### Server Mode\n\nWhen using Neo4j in the \u003ca href=\"http://docs.neo4j.org/chunked/stable/server-installation.html\" target=\"_blank\"\u003estandalone server\u003c/a\u003e mode,\nyou will need the \u003ca href=\"https://github.com/graphaware/neo4j-framework\" target=\"_blank\"\u003eGraphAware Neo4j Framework\u003c/a\u003e and GraphAware Neo4j Expire .jar files (both of which you can \u003ca href=\"http://products.graphaware.com/\" target=\"_blank\"\u003edownload here\u003c/a\u003e) dropped\ninto the `plugins` directory of your Neo4j installation. After changing a few lines of config (read on) and restarting Neo4j, the module will do its magic.\n\n### Embedded Mode / Java Development\n\nJava developers that use Neo4j in \u003ca href=\"http://docs.neo4j.org/chunked/stable/tutorials-java-embedded.html\" target=\"_blank\"\u003eembedded mode\u003c/a\u003e\nand those developing Neo4j \u003ca href=\"http://docs.neo4j.org/chunked/stable/server-plugins.html\" target=\"_blank\"\u003eserver plugins\u003c/a\u003e,\n\u003ca href=\"http://docs.neo4j.org/chunked/stable/server-unmanaged-extensions.html\" target=\"_blank\"\u003eunmanaged extensions\u003c/a\u003e,\nGraphAware Runtime Modules, or Spring MVC Controllers can include the Expire Module as a dependency for their Java project.\n\n#### Releases\n\nReleases are synced to \u003ca href=\"http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22expire%22\" target=\"_blank\"\u003eMaven Central repository\u003c/a\u003e. When using Maven for dependency management, include the following dependency in your pom.xml.\n\n    \u003cdependencies\u003e\n        ...\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.graphaware.neo4j\u003c/groupId\u003e\n            \u003cartifactId\u003eexpire\u003c/artifactId\u003e\n            \u003cversion\u003e3.5.11.54.4\u003c/version\u003e\n        \u003c/dependency\u003e\n        ...\n    \u003c/dependencies\u003e\n\n#### Snapshots\n\nTo use the latest development version, just clone this repository, run `mvn clean install` and change the version in the\ndependency above to 3.5.11.54.5-SNAPSHOT.\n\n#### Note on Versioning Scheme\n\nThe version number has two parts. The first four numbers indicate compatibility with Neo4j GraphAware Framework.\n The last number is the version of the Expire library. For example, version 2.3.3.37.1 is version 1 of the Expire library\n compatible with GraphAware Neo4j Framework 2.3.3.37.\n\nSetup and Configuration\n--------------------\n\n### Server Mode\n\nFirst, please make sure that the framework is configured by adding `dbms.thirdparty_jaxrs_classes=com.graphaware.server=/graphaware` to `conf/neo4j.conf`,\nas described \u003ca href=\"https://github.com/graphaware/neo4j-framework#server-mode\" target=\"_blank\"\u003ehere\u003c/a\u003e.\n\nAnd add this configuration to register the Expire module:\n\n```\ncom.graphaware.runtime.enabled=true\n\n#EM becomes the module ID (you will need to use this ID in other config below):\ncom.graphaware.module.EM.1=com.graphaware.neo4j.expire.ExpirationModuleBootstrapper\n\n#If you want to delete nodes at a certain time, configure the node property (in this case \"expire\")\n#that holds the expiration time in ms since epoch:\ncom.graphaware.module.EM.nodeExpirationProperty=expire\n\n#Alternatively, if you want to delete nodes after some time has elapsed since they have been created,\n#configure the node property (in this case \"ttl\") that holds the TTL in ms:\ncom.graphaware.module.EM.nodeTtlProperty=ttl\n\n#If you want to delete relationships at a certain time, configure the relationships property (in this case \"expire\")\n#that holds the expiration time in ms since epoch:\ncom.graphaware.module.EM.relationshipExpirationProperty=expire\n\n#Alternatively, if you want to delete relationships after some time has elapsed since they have been created,\n#configure the relationships property (in this case \"ttl\") that holds the TTL in ms:\ncom.graphaware.module.EM.relationshipTtlProperty=ttl\n\n#If you want to delete expired nodes despite that fact they still have relationships, set the strategy to \"force\".\n# This setting defaults to \"orphan\", which will only delete expired nodes with no relationships:\ncom.graphaware.module.EM.nodeExpirationStrategy=force\n\n#By default, all created/updated nodes and relationships are checked for the presence of expire/ttl property.\n#As with most GraphAware Modules, nodes and relationships this module applies to can be limited by the use of SPeL, e.g.:\ncom.graphaware.module.EM.node=hasLabel('NodeThatExpiresAtSomePoint')\ncom.graphaware.module.EM.relationship=isType('TEMPORARY_RELATIONSHIP')\n\n#Optionally, configure the maximum number of nodes/relationships deleted in one transaction. Defaults to 1000.\ncom.graphaware.module.EM.maxExpirations=5000\n\n```\n\n### Embedded Mode / Java Development\n\nTo use the Expire module programmatically, register the module like this\n\n```java\n GraphAwareRuntime runtime = GraphAwareRuntimeFactory.createRuntime(database);  //where database is an instance of GraphDatabaseService\n ExpirationModule module = new ExpirationModule(\"EXP\", database, ExpirationConfiguration.defaultConfiguration().withNodeTtlProperty(\"ttl\").withRelationshipTtlProperty(\"ttl\"));\n runtime.registerModule(module);\n runtime.start();\n```\n\nAlternatively:\n```java\n GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(pathToDb)\n    .loadPropertiesFromFile(this.getClass().getClassLoader().getResource(\"neo4j.conf\").getPath())\n    .newGraphDatabase();\n\n //make sure neo4j.properties contain the lines mentioned in previous section\n```\n\nUsing GraphAware Expire\n-----------------------\n\nApart from the configuration described above, the GraphAware Expire module requires nothing else to function. It will\ndelete nodes and relationships when they've reached their expiration date or TTL. In case both expiration date and TTL are\nset, the module takes into account whichever one is later. Please note a few more facts of interest:\n\n* by default, nodes are only deleted if they have no relationship (i.e. all relationships have expired or have been manually deleted), unless the node expiration strategy is set to \"force\".\n* when ttl property gets updated, the time-to-live is counted from the moment the node has been updated\n* one of the following must be configured, otherwise it does not make sense to use the module: `nodeExpirationProperty`, `nodeTtlProperty`, `relationshipExpirationProperty`, `relationshipTtlProperty`.\n\nAdvanced Config\n---------------\n\nNodes and relationships, along with their expiration dates, are stored in Neo4j's \u003ca href=\"http://neo4j.com/docs/stable/indexing.html\" target=\"_blank\"\u003elegacy index\u003c/a\u003e, completely transparently to the user.\nA GraphAware Framework \u003ca href=\"https://github.com/graphaware/neo4j-framework/tree/master/runtime#building-a-timer-driven-graphaware-runtime-module\" target=\"_blank\"\u003eTimer-Driven Runtime Module\u003c/a\u003e checks for expired nodes and relationships every time it is asked to\nperform work, and deletes the ones that are found.\n\nPlease note that the default setting for the Timer-Driven Runtime Module is and \"adaptive\" strategy that it slows down\nbackground processing when the database is busy. By default, the maximum delay between invocations is 5 seconds.\nIf you want a shorter and/or more predictable time between a node/relationship reaching its expiration date and actually\nbeing deleted, you can change this strategy. For example, if you wanted to check for expired elements every 100ms consistently,\nyou could add the following lines to neo4j.properties:\n\n```\ncom.graphaware.runtime.timing.strategy=fixed\ncom.graphaware.runtime.timing.initialDelay=100\ncom.graphaware.runtime.timing.delay=100\n```\n\nLicense\n-------\n\nCopyright (c) 2013-2020 GraphAware\n\nGraphAware is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License\nas published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\nwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\nYou should have received a copy of the GNU General Public License along with this program.\nIf not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphaware%2Fneo4j-expire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphaware%2Fneo4j-expire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphaware%2Fneo4j-expire/lists"}